diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-13 01:19:03 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-04-19 21:06:40 +0200 |
commit | 838710bd6c5f65d436408c0737b49628f23f9ca9 (patch) | |
tree | 78ea7db01ecd12b748b98208f3fbb6aa653942ee | |
parent | 3ed360ea5cbadc9791952786bcbdd2d5fb90e81b (diff) | |
download | ffmpeg-838710bd6c5f65d436408c0737b49628f23f9ca9.tar.gz |
avcodec/pictordec: Only recalculate d when y changes in picmemset()
Fixes: Timeout (21->18sec)
Fixes: 14124/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PICTOR_fuzzer-5633887734071296
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/pictordec.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index af99c486b8..2e6fcdca52 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -68,10 +68,10 @@ static void picmemset(PicContext *s, AVFrame *frame, unsigned value, int run, int planel = *plane; value <<= shift; + d = frame->data[0] + yl * frame->linesize[0]; while (run > 0) { int j; for (j = 8-bits_per_plane; j >= 0; j -= bits_per_plane) { - d = frame->data[0] + yl * frame->linesize[0]; d[xl] |= (value >> j) & mask; xl += 1; if (xl == s->width) { @@ -85,6 +85,7 @@ static void picmemset(PicContext *s, AVFrame *frame, unsigned value, int run, value <<= bits_per_plane; mask <<= bits_per_plane; } + d = frame->data[0] + yl * frame->linesize[0]; } } run--; |