diff mbox series

[FFmpeg-devel,2/2] avformat/dxa: check bpc

Message ID 20241019011722.840224-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/2] swscale/slice: clear allocated memory in alloc_lines() | expand

Commit Message

Michael Niedermayer Oct. 19, 2024, 1:17 a.m. UTC
Fixes: integer overflow: -2147483648 - 1 cannot be represented in type 'int'
Fixes: 373971762/clusterfuzz-testcase-minimized-ffmpeg_dem_DXA_fuzzer-4880491112103936

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/dxa.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 813e665a27a..56b19a7fca9 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -120,6 +120,8 @@  static int dxa_read_header(AVFormatContext *s)
             avio_skip(pb, fsize);
         }
         c->bpc = (fsize + (int64_t)c->frames - 1) / c->frames;
+        if (c->bpc < 0)
+            return AVERROR_INVALIDDATA;
         if(ast->codecpar->block_align) {
             if (c->bpc > INT_MAX - ast->codecpar->block_align + 1)
                 return AVERROR_INVALIDDATA;