[FFmpeg-cvslog] gsm: log error message when packet is too small

Justin Ruggles git at videolan.org
Thu Nov 3 02:23:11 CET 2011


ffmpeg | branch: master | Justin Ruggles <justin.ruggles at gmail.com> | Fri Oct 28 10:18:07 2011 -0400| [9d52f0a7113d9ce14e038f8e65fd0e92ce0d33c1] | committer: Justin Ruggles

gsm: log error message when packet is too small

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d52f0a7113d9ce14e038f8e65fd0e92ce0d33c1
---

 libavcodec/gsmdec.c |    4 +++-
 libavcodec/libgsm.c |    6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/gsmdec.c b/libavcodec/gsmdec.c
index f084b14..1091745 100644
--- a/libavcodec/gsmdec.c
+++ b/libavcodec/gsmdec.c
@@ -66,8 +66,10 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data,
         return AVERROR(EINVAL);
     }
 
-    if(buf_size < avctx->block_align)
+    if (buf_size < avctx->block_align) {
+        av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
         return AVERROR_INVALIDDATA;
+    }
 
     switch (avctx->codec_id) {
     case CODEC_ID_GSM:
diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c
index 790eacd..1b12ca4 100644
--- a/libavcodec/libgsm.c
+++ b/libavcodec/libgsm.c
@@ -175,7 +175,11 @@ static int libgsm_decode_frame(AVCodecContext *avctx,
         return AVERROR(EINVAL);
     }
 
-    if(buf_size < avctx->block_align) return -1;
+    if (buf_size < avctx->block_align) {
+        av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     switch(avctx->codec_id) {
     case CODEC_ID_GSM:
         if(gsm_decode(avctx->priv_data,buf,data)) return -1;



More information about the ffmpeg-cvslog mailing list