aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-09-18 14:47:25 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-10-28 21:04:04 +0200
commit7280495991b0b66a3d82d41a8862e232b4629d4e (patch)
tree86c637e085c121cbd5814851e60ae60c5fc89fda
parentf534619700a46bc5e5ed7ca1bf01919dc2b74fc8 (diff)
downloadffmpeg-7280495991b0b66a3d82d41a8862e232b4629d4e.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>
-rw-r--r--libavformat/nutdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index d0972517cd..b8b7f0469a 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -278,6 +278,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);