summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-17 13:05:24 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-10-17 13:17:18 +0200
commit0279e727e99282dfa6c7019f468cb217543be243 (patch)
treed70ea6a79ddedd50ded56dae589a75354759bc0b
parent097c917c147661f5378dae8fe3f7e46f43236426 (diff)
downloadffmpeg-streaming-0279e727e99282dfa6c7019f468cb217543be243.zip
ffmpeg-streaming-0279e727e99282dfa6c7019f468cb217543be243.tar.gz
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>
-rw-r--r--libavcodec/cavsdec.c16
-rw-r--r--tests/ref/fate/cavs2
2 files changed, 13 insertions, 5 deletions
diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 436f902..aaed807 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);
diff --git a/tests/ref/fate/cavs b/tests/ref/fate/cavs
index 4c3d127..89c2b4b 100644
--- a/tests/ref/fate/cavs
+++ b/tests/ref/fate/cavs
@@ -172,4 +172,4 @@
0, 166, 166, 1, 622080, 0x05496a5d
0, 167, 167, 1, 622080, 0xdcb4cee8
0, 168, 168, 1, 622080, 0xb41172e5
-0, 169, 169, 1, 622080, 0x26146e0b
+0, 169, 169, 1, 622080, 0x84ff3af9
OpenPOWER on IntegriCloud