X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fpnm_parser.c;h=d19dbfe98c0790e8d6919549f9d972768e43ae57;hb=1a35fffaf24bf8a20d629c32f6c702b241c4b83f;hp=94777d2ccaf914a39577a3b913e0c9eefd397d8c;hpb=34f6d1a7d7859310914d7f34e8cc3b68d6254003;p=ffmpeg diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c index 94777d2ccaf..d19dbfe98c0 100644 --- a/libavcodec/pnm_parser.c +++ b/libavcodec/pnm_parser.c @@ -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;