aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-19 17:59:53 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-09-11 21:23:48 +0200
commit4a9b5ec1e8010c0e8cc7b53bebed5a6a7c359ec6 (patch)
tree908d8a7dd9faef4fbb599ad86b3c3a04a8de74a2
parentbb7ad5c1285596b0176e0eeafc8519dade3fbff7 (diff)
downloadffmpeg-4a9b5ec1e8010c0e8cc7b53bebed5a6a7c359ec6.tar.gz
avformat/wtvdec: Check dir_length
Fixes: Infinite loop Fixes: 26445/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-5125558331244544 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 1868cb731660490beb750389266adb6e68e9123d) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/wtvdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 77737fa9e7..366a42829f 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -274,6 +274,11 @@ static AVIOContext * wtvfile_open2(AVFormatContext *s, const uint8_t *buf, int b
"bad filename length, remaining directory entries ignored\n");
break;
}
+ if (dir_length == 0) {
+ av_log(s, AV_LOG_ERROR,
+ "bad dir length, remaining directory entries ignored\n");
+ break;
+ }
if (48 + (int64_t)name_size > buf_end - buf) {
av_log(s, AV_LOG_ERROR, "filename exceeds buffer size; remaining directory entries ignored\n");
break;