diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-04-25 20:01:03 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-10-09 22:02:21 +0200 |
commit | 59971fee9c0d44cbcd9883bd9c1a5bf29f27a124 (patch) | |
tree | d0ff7f245a1fd06905ba388e816f63a9422f406a | |
parent | a971e35df12ffcd916308ad8c82d7707b93656c7 (diff) | |
download | ffmpeg-59971fee9c0d44cbcd9883bd9c1a5bf29f27a124.tar.gz |
avformat/nutdec: Check tmp_size
Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6739990530883584
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 1ca00b5e44f21840b608e238fa135a1aab6e576b)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-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 2ebb10ce8c..23591d73a4 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -322,6 +322,11 @@ static int decode_main_header(NUTContext *nut) ret = AVERROR_INVALIDDATA; goto fail; } + if (tmp_size < 0 || tmp_size > INT_MAX - count) { + av_log(s, AV_LOG_ERROR, "illegal size\n"); + ret = AVERROR_INVALIDDATA; + goto fail; + } for (j = 0; j < count; j++, i++) { if (i == 'N') { |