]> git.sesse.net Git - ffmpeg/commitdiff
xwddec: prevent overflow of lsize * avctx->height
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Fri, 18 Dec 2015 18:28:51 +0000 (19:28 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Sat, 19 Dec 2015 13:28:51 +0000 (14:28 +0100)
This is used to check if the input buffer is large enough, so if this
overflows it can cause a false negative leading to a segmentation fault
in bytestream2_get_bufferu.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavcodec/xwddec.c

index 2febedc4aa5c4fd440c8cfb04270519a373faea2..64cd8418a2083ef2b54db1b476e049efeebc0413 100644 (file)
@@ -141,7 +141,7 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
         return AVERROR_INVALIDDATA;
     }
 
-    if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + avctx->height * lsize) {
+    if (bytestream2_get_bytes_left(&gb) < ncolors * XWD_CMAP_SIZE + (uint64_t)avctx->height * lsize) {
         av_log(avctx, AV_LOG_ERROR, "input buffer too small\n");
         return AVERROR_INVALIDDATA;
     }