avcodec/mjpegdec: Check for end for both bytes in unescaping

Fixes assertion failure
Fixes: c40c779601b77dc6e19aaea0b04b9751/signal_sigabrt_7ffff6ae7cb7_5769_b94f6ec70caecb2d3d76b4771b109ac1.avi

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 509c9e74e5)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2016-01-21 21:01:47 +01:00
parent 76de78a9db
commit fa9873cce8
1 changed files with 1 additions and 1 deletions

View File

@ -1915,7 +1915,7 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
while (b < t) { while (b < t) {
uint8_t x = src[b++]; uint8_t x = src[b++];
put_bits(&pb, 8, x); put_bits(&pb, 8, x);
if (x == 0xFF) { if (x == 0xFF && b < t) {
x = src[b++]; x = src[b++];
if (x & 0x80) { if (x & 0x80) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n"); av_log(s->avctx, AV_LOG_WARNING, "Invalid escape sequence\n");