aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <nfxjfg@googlemail.com>2015-01-07 23:57:50 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-01-08 02:11:29 +0100
commit8a3a3e3154b78c8d90d3b62c38054a959911b79f (patch)
tree9a6162507f5ce2f09ecadc3220c8664a9b59a694
parent5410d6d26fc603df80915a9bce863cbcd3eb1fc4 (diff)
downloadffmpeg-8a3a3e3154b78c8d90d3b62c38054a959911b79f.tar.gz
avcodec/dvdsubdec: error on bitmaps with size 0
Attemtping to decode them could lead to invalid writes with some fuzzed samples. Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit bcaa9099b3648b47060e1724a97dc98b63c83702) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/dvdsubdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 220063327e..8d67c50b5a 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -102,6 +102,9 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
if (start >= buf_size)
return -1;
+ if (w <= 0 || h <= 0)
+ return -1;
+
bit_len = (buf_size - start) * 8;
init_get_bits(&gb, buf + start, bit_len);