summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2019-08-01 00:50:21 +0200
committerMichael Niedermayer <[email protected]>2019-11-15 12:25:45 +0100
commit66e60b3c968541ed82fc0d7e10c6c76bb6bdbc05 (patch)
tree5226a39d8ff6d3be4e1b28f33f9382b14daea251
parent87a487157190d88574b44759bbf5d0b5299ed388 (diff)
avcodec/indeo2: Check remaining input more often
Fixes: Timeout (95sec -> 30ms) Fixes: 14765/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_INDEO2_fuzzer-5692455527120896 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpe Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit 52939a2c5772ec00101d293695d0a96dcccf99d9) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavcodec/indeo2.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c
index 4971b84308..3c8934e377 100644
--- a/libavcodec/indeo2.c
+++ b/libavcodec/indeo2.c
@@ -79,10 +79,11 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
for (j = 1; j < height; j++) {
out = 0;
- if (get_bits_left(&ctx->gb) <= 0)
- return AVERROR_INVALIDDATA;
while (out < width) {
- int c = ir2_get_code(&ctx->gb);
+ int c;
+ if (get_bits_left(&ctx->gb) <= 0)
+ return AVERROR_INVALIDDATA;
+ c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a skip */
c -= 0x7F;
if (out + c*2 > width)
@@ -123,9 +124,9 @@ static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_
for (j = 0; j < height; j++) {
out = 0;
- if (get_bits_left(&ctx->gb) <= 0)
- return AVERROR_INVALIDDATA;
while (out < width) {
+ if (get_bits_left(&ctx->gb) <= 0)
+ return AVERROR_INVALIDDATA;
c = ir2_get_code(&ctx->gb);
if (c >= 0x80) { /* we have a skip */
c -= 0x7F;