[FFmpeg-devel] [PATCH] xwddec: prevent overflow of lsize * avctx->height
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Fri Dec 18 20:04:56 CET 2015
This is used to check if the input buffer is larger enough, so if this
overflows it can cause a false negative leading to a segmentation fault
in bytestream2_get_bufferu.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
libavcodec/xwddec.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/libavcodec/xwddec.c b/libavcodec/xwddec.c
index 2febedc..311eeec 100644
--- a/libavcodec/xwddec.c
+++ b/libavcodec/xwddec.c
@@ -127,6 +127,12 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_INVALIDDATA;
}
+ if (lsize > UINT_MAX / avctx->height) {
+ av_log(avctx, AV_LOG_ERROR, "lsize %u too large for height %d\n",
+ lsize, avctx->height);
+ return AVERROR_INVALIDDATA;
+ }
+
if (ncolors > 256) {
av_log(avctx, AV_LOG_ERROR, "invalid number of entries in colormap\n");
return AVERROR_INVALIDDATA;
--
2.6.2
More information about the ffmpeg-devel
mailing list