diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-08-31 20:48:18 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-02 20:28:53 +0300 |
commit | 31f03120e8d03775c67404af11dc7d5fb90f590c (patch) | |
tree | 0d07daf9222a6d20967bd55ed40d9a1c6758fce1 /libavcodec/pictordec.c | |
parent | cbf111059d2bbce6d1fe4a9c54323265b736a470 (diff) |
avcodec/pictordec: Optimize more odd cases for picmemset()
Fixes: Timeout
Fixes: 36875/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PICTOR_fuzzer-4842960888922112
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Tested-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/pictordec.c')
-rw-r--r-- | libavcodec/pictordec.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index c37c5e7106..c7b3a335d3 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -89,8 +89,7 @@ static void picmemset(PicContext *s, AVFrame *frame, unsigned value, int run, d = frame->data[0] + yl * frame->linesize[0]; if (s->nb_planes == 1 && run*pixels_per_value >= s->width && - pixels_per_value < s->width && - s->width % pixels_per_value == 0 + pixels_per_value < (s->width / pixels_per_value * pixels_per_value) ) { for (; xl < pixels_per_value; xl ++) { j = (j < bits_per_plane ? 8 : j) - bits_per_plane; @@ -98,7 +97,7 @@ static void picmemset(PicContext *s, AVFrame *frame, unsigned value, int run, } av_memcpy_backptr(d+xl, pixels_per_value, s->width - xl); run -= s->width / pixels_per_value; - xl = s->width; + xl = s->width / pixels_per_value * pixels_per_value; } } } |