diff mbox series

[FFmpeg-devel,2/6] avcodec/utils: Ensure linesize for SVQ3

Message ID 20230111204221.22550-2-michael@niedermayer.cc
State Accepted
Commit 4eef658ca59d3d6ba46ab52a36d7faf5fe820874
Headers show
Series [FFmpeg-devel,1/6] avcodec/utils: allocate a line more for VC1 and WMV3 | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Michael Niedermayer Jan. 11, 2023, 8:42 p.m. UTC
Fixes: Assertion block_w * sizeof(uint8_t) <= ((buf_linesize) >= 0 ? (buf_linesize) : (-(buf_linesize))
Fixes: 54861/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5352418248622080

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

Patch

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1aa0a05a31..30dea8a813 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -335,6 +335,9 @@  void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
         // the next rounded up width is 32
         *width = FFMAX(*width, 32);
     }
+    if (s->codec_id == AV_CODEC_ID_SVQ3) {
+        *width = FFMAX(*width, 32);
+    }
 
     for (i = 0; i < 4; i++)
         linesize_align[i] = STRIDE_ALIGN;