[FFmpeg-cvslog] vmnc: check input size before reading chunk header, fix overread

Michael Niedermayer git at videolan.org
Wed Nov 14 03:43:32 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov 14 02:50:59 2012 +0100| [39c5cd601ef09b1a540471960cb3a7e3ba17cb3c] | committer: Michael Niedermayer

vmnc: check input size before reading chunk header, fix overread

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/vmnc.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c
index 62a1312..d3c86f1 100644
--- a/libavcodec/vmnc.c
+++ b/libavcodec/vmnc.c
@@ -332,6 +332,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
     src += 2;
     chunks = AV_RB16(src); src += 2;
     while(chunks--) {
+        if(buf_size - (src - buf) < 12) {
+            av_log(avctx, AV_LOG_ERROR, "Premature end of data!\n");
+            return -1;
+        }
         dx = AV_RB16(src); src += 2;
         dy = AV_RB16(src); src += 2;
         w  = AV_RB16(src); src += 2;



More information about the ffmpeg-cvslog mailing list