aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-04 20:13:18 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-12 18:03:50 +0100
commit5c0413aa85f75cd9b9beffd984947560a080d914 (patch)
tree66b5e0709351509676b13644a39930c94e045f41
parentd0a925ba2e7c299da93956a61b6a95a8c909e0f2 (diff)
downloadffmpeg-5c0413aa85f75cd9b9beffd984947560a080d914.tar.gz
avcodec/mjpegdec: Check escape sequence validity
Fixes assertion failure Fixes: asan_heap-oob_1c1a4ea_1242_cov_2274415971_TESTcmyk.jpg Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/mjpegdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 84bc9aa33d..694a46009a 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1573,6 +1573,10 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
put_bits(&pb, 8, x);
if (x == 0xFF) {
x = src[b++];
+ if (x & 0x80) {
+ av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n");
+ x &= 0x7f;
+ }
put_bits(&pb, 7, x);
bit_count--;
}