diff mbox

[FFmpeg-devel] avcodec/arbc: Skip tiles in fill_tileX() which are completely outside

Message ID 20190509234649.7926-1-michael@niedermayer.cc
State Accepted
Commit cdd886a286fb7d55a7d525ec479b49284b7f8b44
Headers show

Commit Message

Michael Niedermayer May 9, 2019, 11:46 p.m. UTC
Fixes: signed integer overflow: 2052526848 + 147237888 cannot be represented in type 'int'
Fixes: 14441/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARBC_fuzzer-5717632944177152

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

Comments

Michael Niedermayer June 4, 2019, 8:52 a.m. UTC | #1
On Fri, May 10, 2019 at 01:46:49AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 2052526848 + 147237888 cannot be represented in type 'int'
> Fixes: 14441/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ARBC_fuzzer-5717632944177152
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/arbc.c | 3 +++
>  1 file changed, 3 insertions(+)

will apply

[...]
diff mbox

Patch

diff --git a/libavcodec/arbc.c b/libavcodec/arbc.c
index bce4a4c96d..06970f140b 100644
--- a/libavcodec/arbc.c
+++ b/libavcodec/arbc.c
@@ -94,6 +94,9 @@  static int fill_tileX(AVCodecContext *avctx, int tile_width, int tile_height,
         int start_y = y * tile_height, start_x = x * tile_width;
         int end_y = start_y + tile_height, end_x = start_x + tile_width;
 
+        if (start_x >= avctx->width || start_y >= avctx->height)
+            continue;
+
         for (int j = start_y; j < end_y; j += step_h) {
             for (int k = start_x; k < end_x; k += step_w) {
                 if (mask & 0x8000U) {