mirror of https://git.ffmpeg.org/ffmpeg.git
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/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 10ea6c3116
)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
69be8cc6e0
commit
48659851e2
|
@ -92,8 +92,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;
|
||||
|
|
Loading…
Reference in New Issue