jvdec: check videosize
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 28 May 2012 15:21:29 +0000 (17:21 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 28 May 2012 15:26:21 +0000 (17:26 +0200)
Fixes null ptr dereference
fixes Ticket1364

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b4904e804d3b1c56ac4f5d3386b15daae98fca2d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/jvdec.c

index d371950..4031fad 100644 (file)
@@ -143,6 +143,10 @@ static int decode_frame(AVCodecContext *avctx,
     buf += 5;
 
     if (video_size) {
+        if(video_size < 0) {
+            av_log(avctx, AV_LOG_ERROR, "video size %d invalid\n", video_size);
+            return AVERROR_INVALIDDATA;
+        }
         if (avctx->reget_buffer(avctx, &s->frame) < 0) {
             av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
             return -1;