aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-30 22:04:37 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-09 13:53:29 +0200
commit47047bf6850fc98cad0024b1de4fd6509c22ef2e (patch)
treef305d18817333eb069e365fcac0ecb06b6fd4735 /libavformat
parentb4317e0a2b77f9ddebd7590baa3fe42990630b71 (diff)
downloadffmpeg-47047bf6850fc98cad0024b1de4fd6509c22ef2e.tar.gz
avformat/rmdec: Check remaining space in debug av_log() loop
Fixes: Timeout (long -> 2 ms) Fixes: 26709/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5665833403285504 Fixes: 27522/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-6321071221112832 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 a8fe78decd700afec461f06df4ce0d36f3e9cc4b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rmdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 4bcf8e59c0..dfc512e52c 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -1291,8 +1291,11 @@ static int ivr_read_header(AVFormatContext *s)
int j;
av_log(s, AV_LOG_DEBUG, "%s = '0x", key);
- for (j = 0; j < len; j++)
+ for (j = 0; j < len; j++) {
+ if (avio_feof(pb))
+ return AVERROR_INVALIDDATA;
av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb));
+ }
av_log(s, AV_LOG_DEBUG, "'\n");
} else if (len == 4 && type == 3 && !strncmp(key, "Duration", tlen)) {
st->duration = avio_rb32(pb);