aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-11-14 18:23:24 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-04-06 20:38:05 +0200
commit0b0d4f141b13b6184b3d8fd727a05c0432bfb04e (patch)
tree0d3402e035a4b50e323ab89776e73fcb94a761f1
parent00530ff352bf09d5ce64d7af153241fc43e94478 (diff)
downloadffmpeg-0b0d4f141b13b6184b3d8fd727a05c0432bfb04e.tar.gz
avformat/avidec: Check read_odml_index() for failure
Fixes: Timeout Fixes: 40950/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6478873068437504 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 57adb26d058490daf2c5d6ddd3cf0cf2d2212256) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/avidec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index cd7bd08567..21b234b2de 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -232,6 +232,8 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
} else {
int64_t offset, pos;
int duration;
+ int ret;
+
offset = avio_rl64(pb);
avio_rl32(pb); /* size */
duration = avio_rl32(pb);
@@ -249,7 +251,7 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
if (avio_seek(pb, offset + 8, SEEK_SET) < 0)
return -1;
avi->odml_depth++;
- read_odml_index(s, frame_num);
+ ret = read_odml_index(s, frame_num);
avi->odml_depth--;
frame_num += duration;
@@ -257,7 +259,8 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
av_log(s, AV_LOG_ERROR, "Failed to restore position after reading index\n");
return -1;
}
-
+ if (ret < 0)
+ return ret;
}
}
avi->index_loaded = 2;