diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2022-09-18 14:47:25 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-10-21 22:19:37 +0200 |
commit | f8074b797fc392a32a11bff098417358b1a8abe6 (patch) | |
tree | 61b56dc3c24f6650f4b496e6c8f26f158c139d9d /libavformat/nutdec.c | |
parent | c91ed5ee63aac0c5e5af6ce365704a38994ac386 (diff) | |
download | ffmpeg-f8074b797fc392a32a11bff098417358b1a8abe6.tar.gz |
avformat/nutdec: Check fields
Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6566001610719232
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 2c146406eac06f3d3cd3d981c29e7affd834cb4d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/nutdec.c')
-rw-r--r-- | libavformat/nutdec.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 3d07eb250a..bc2ee7bcd5 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -280,6 +280,11 @@ static int decode_main_header(NUTContext *nut) for (i = 0; i < 256;) { int tmp_flags = ffio_read_varlen(bc); int tmp_fields = ffio_read_varlen(bc); + if (tmp_fields < 0) { + av_log(s, AV_LOG_ERROR, "fields %d is invalid\n", tmp_fields); + ret = AVERROR_INVALIDDATA; + goto fail; + } if (tmp_fields > 0) tmp_pts = get_s(bc); |