aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/scpr.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-07-30 00:52:18 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-09-04 20:26:35 +0200
commit3bff0de66b4bc9d91c36596cb45024b5f26dedbd (patch)
tree54dfc4a456415738ce03243fb243fb17dd1fcf60 /libavcodec/scpr.c
parent3223f4229a2bb2d096e9f3fdea61053dda5f62e8 (diff)
downloadffmpeg-3bff0de66b4bc9d91c36596cb45024b5f26dedbd.tar.gz
avcodec/scpr: Use av_memcpy_backptr() in type 17 and 33
This makes the changed code-path faster. Change not tested except with the fuzzer testcase as I found no other testcase. Improves: Timeout (136sec -> 74sec) Improves: 16040/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5705876062601216 Reviewed-by: Paul B Mahol <onemda@gmail.com> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg (cherry picked from commit 950a21e83c742714d6afbecd3e3fd1887e80fa40) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/scpr.c')
-rw-r--r--libavcodec/scpr.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/scpr.c b/libavcodec/scpr.c
index 317950dafb..dc890a87e5 100644
--- a/libavcodec/scpr.c
+++ b/libavcodec/scpr.c
@@ -532,7 +532,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
s->current_frame->linesize[0] / 4);
} else if (type == 17 || type == 33) {
uint32_t clr, *dst = (uint32_t *)s->current_frame->data[0];
- int x, y;
+ int y;
frame->key_frame = 1;
bytestream2_skip(gb, 1);
@@ -548,9 +548,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
clr = bytestream2_get_le24(gb);
}
for (y = 0; y < avctx->height; y++) {
- for (x = 0; x < avctx->width; x++) {
- dst[x] = clr;
- }
+ dst[0] = clr;
+ av_memcpy_backptr((uint8_t*)(dst+1), 4, 4*avctx->width - 4);
dst += s->current_frame->linesize[0] / 4;
}
} else if (type == 0 || type == 1) {