[FFmpeg-cvslog] avcodec/wmalosslessdec: Fix return code for invalid buffer sizes

Michael Niedermayer git at videolan.org
Wed Sep 25 22:01:19 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Sep 25 21:42:56 2013 +0200| [851a6e2f1aee6b254dd5155a358955c19926087a] | committer: Michael Niedermayer

avcodec/wmalosslessdec: Fix return code for invalid buffer sizes

Fixes infinite loop
Fixes Ticket2979

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/wmalosslessdec.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index 50927ca..df44855 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -1178,8 +1178,10 @@ static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr,
         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, "buf size %d invalid\n", buf_size);
+            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