diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-10-17 14:05:24 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-10-17 14:17:18 +0300 |
commit | 0279e727e99282dfa6c7019f468cb217543be243 (patch) | |
tree | d70ea6a79ddedd50ded56dae589a75354759bc0b /libavcodec/cavsdec.c | |
parent | 097c917c147661f5378dae8fe3f7e46f43236426 (diff) |
avcodec/cavsdec: Set ret on errors in decode_pic()
Fixes regression and fate failure on some machienes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/cavsdec.c')
-rw-r--r-- | libavcodec/cavsdec.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index 436f902ab3..aaed807196 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -1102,15 +1102,19 @@ static int decode_pic(AVSContext *h) if (check_for_slice(h)) skip_count = -1; if (h->skip_mode_flag && (skip_count < 0)) { - if (get_bits_left(&h->gb) < 1) + if (get_bits_left(&h->gb) < 1) { + ret = AVERROR_INVALIDDATA; break; + } skip_count = get_ue_golomb(&h->gb); } if (h->skip_mode_flag && skip_count--) { decode_mb_p(h, P_SKIP); } else { - if (get_bits_left(&h->gb) < 1) + if (get_bits_left(&h->gb) < 1) { + ret = AVERROR_INVALIDDATA; break; + } mb_type = get_ue_golomb(&h->gb) + P_SKIP + h->skip_mode_flag; if (mb_type > P_8X8) ret = decode_mb_i(h, mb_type - P_8X8 - 1); @@ -1125,15 +1129,19 @@ static int decode_pic(AVSContext *h) if (check_for_slice(h)) skip_count = -1; if (h->skip_mode_flag && (skip_count < 0)) { - if (get_bits_left(&h->gb) < 1) + if (get_bits_left(&h->gb) < 1) { + ret = AVERROR_INVALIDDATA; break; + } skip_count = get_ue_golomb(&h->gb); } if (h->skip_mode_flag && skip_count--) { ret = decode_mb_b(h, B_SKIP); } else { - if (get_bits_left(&h->gb) < 1) + if (get_bits_left(&h->gb) < 1) { + ret = AVERROR_INVALIDDATA; break; + } mb_type = get_ue_golomb(&h->gb) + B_SKIP + h->skip_mode_flag; if (mb_type > B_8X8) ret = decode_mb_i(h, mb_type - B_8X8 - 1); |