Commit 10ea6c31 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/pnm_parser: Use memchr() in pnm_parse()

Fixes: Timeout (45sec -> 0.5sec)
Fixes: 16942/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PPM_fuzzer-5085393073995776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegReviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent b794df43
......@@ -95,8 +95,11 @@ retry:
sync = bs;
c = *bs++;
if (c == '#') {
while (c != '\n' && bs < end)
c = *bs++;
uint8_t *match = memchr(bs, '\n', end-bs);
if (match)
bs = match + 1;
else
break;
} else if (c == 'P') {
next = bs - pnmctx.bytestream_start + skip - 1;
pnmpc->ascii_scan = 0;
......
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