[FFmpeg-cvslog] wmaprodec: return an error, not 0, when the input is too small.

Anton Khirnov git at videolan.org
Thu Mar 14 04:24:06 CET 2013


ffmpeg | branch: release/1.1 | Anton Khirnov <anton at khirnov.net> | Wed Mar  6 10:02:50 2013 +0100| [60dd8b5733f9ec4919fbc732ace1be8184dde880] | committer: Reinhard Tartler

wmaprodec: return an error, not 0, when the input is too small.

Returning 0 may result in an infinite loop in valid calling programs. A
decoder should never return 0 without producing any output.

CC:libav-stable at libav.org
(cherry picked from commit 4c0080b7e7d501e2720d2a61f5186a18377f9d63)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavcodec/wmaprodec.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index d58278b..ff96788 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -1504,8 +1504,11 @@ static int decode_packet(AVCodecContext *avctx, void *data,
         s->packet_done = 0;
 
         /** sanity check for the buffer length */
-        if (buf_size < avctx->block_align)
-            return 0;
+        if (buf_size < avctx->block_align) {
+            av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n",
+                   buf_size, avctx->block_align);
+            return AVERROR_INVALIDDATA;
+        }
 
         s->next_packet_start = buf_size - avctx->block_align;
         buf_size = avctx->block_align;



More information about the ffmpeg-cvslog mailing list