Fixes: out of array read Fixes: Ticket 10308
Unified · Split
| @@ -281,7 +281,7 @@ static int decode_slice(MpegEncContext *s) · 280 unmodified lines | |||
| 281 | ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, | 281 | ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, |
| 282 | s->mb_x, s->mb_y, ER_MB_ERROR & part_mask); | 282 | s->mb_x, s->mb_y, ER_MB_ERROR & part_mask); |
| 283 | 283 | ||
| 284 | if (s->avctx->err_recognition & AV_EF_IGNORE_ERR) | 284 | if ((s->avctx->err_recognition & AV_EF_IGNORE_ERR) && get_bits_left(&s->gb) > 0) |
| 285 | continue; | 285 | continue; |
| 286 | return AVERROR_INVALIDDATA; | 286 | return AVERROR_INVALIDDATA; |
| 287 | } | 287 | } |
| @@ -1437,7 +1437,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, · 1436 unmodified lines | |||
| 1437 | if (SHOW_UBITS(re, &s->gb, 1) == 0) { | 1437 | if (SHOW_UBITS(re, &s->gb, 1) == 0) { |
| 1438 | av_log(s->avctx, AV_LOG_ERROR, | 1438 | av_log(s->avctx, AV_LOG_ERROR, |
| 1439 | "1. marker bit missing in 3. esc\n"); | 1439 | "1. marker bit missing in 3. esc\n"); |
| 1440 | if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR)) | 1440 | if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR) || get_bits_left(&s->gb) <= 0) |
| 1441 | return AVERROR_INVALIDDATA; | 1441 | return AVERROR_INVALIDDATA; |
| 1442 | } | 1442 | } |
| 1443 | SKIP_CACHE(re, &s->gb, 1); | 1443 | SKIP_CACHE(re, &s->gb, 1); |
| @@ -1448,7 +1448,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, · 4 unmodified lines | |||
| 1448 | if (SHOW_UBITS(re, &s->gb, 1) == 0) { | 1448 | if (SHOW_UBITS(re, &s->gb, 1) == 0) { |
| 1449 | av_log(s->avctx, AV_LOG_ERROR, | 1449 | av_log(s->avctx, AV_LOG_ERROR, |
| 1450 | "2. marker bit missing in 3. esc\n"); | 1450 | "2. marker bit missing in 3. esc\n"); |
| 1451 | if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR)) | 1451 | if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR) || get_bits_left(&s->gb) <= 0) |
| 1452 | return AVERROR_INVALIDDATA; | 1452 | return AVERROR_INVALIDDATA; |
| 1453 | } | 1453 | } |
| 1454 | 1454 | ||