Commit 936ca7f1 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/sanm: Optimize fill_frame() with av_memcpy_backptr()

Fixes: Timeout (76 sec -> 24 sec)
Fixes: 15043/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SANM_fuzzer-5699856238116864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent e69106e7
......@@ -1358,8 +1358,10 @@ static int read_frame_header(SANMVideoContext *ctx, SANMFrameHeader *hdr)
static void fill_frame(uint16_t *pbuf, int buf_size, uint16_t color)
{
while (buf_size--)
if (buf_size--) {
*pbuf++ = color;
av_memcpy_backptr((uint8_t*)pbuf, 2, 2*buf_size);
}
}
static int copy_output(SANMVideoContext *ctx, SANMFrameHeader *hdr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment