mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avcodec/pnm_parser: Support concatenated ASCII images
Fixes: Timeout (8sec -> 0.1sec) Fixes: 13864/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAM_fuzzer-5737860621139968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
2be7c388db
commit
7f3d39b21f
@ -60,7 +60,22 @@ retry:
|
||||
}
|
||||
next = END_NOT_FOUND;
|
||||
} else if (pnmctx.type < 4) {
|
||||
uint8_t *bs = pnmctx.bytestream;
|
||||
const uint8_t *end = pnmctx.bytestream_end;
|
||||
|
||||
next = END_NOT_FOUND;
|
||||
while (bs < end) {
|
||||
int c = *bs++;
|
||||
if (c == '#') {
|
||||
while (c != '\n' && bs < end)
|
||||
c = *bs++;
|
||||
} else if (c == 'P') {
|
||||
next = bs - pnmctx.bytestream_start + skip - 1;
|
||||
if (pnmctx.bytestream_start != buf + skip)
|
||||
next -= pc->index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
next = pnmctx.bytestream - pnmctx.bytestream_start + skip
|
||||
+ av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user