[FFmpeg-cvslog] avcodec/pnm_parser: Avoid reparsing failed data.

Michael Niedermayer git at videolan.org
Sat Aug 4 17:18:12 EEST 2018


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Jul 28 14:09:32 2018 +0200| [1940c27c8272843f5139a25758fb92b1b1858cbe] | committer: Michael Niedermayer

avcodec/pnm_parser: Avoid reparsing failed data.

Alternatively the parser could be re implemented / redesigned so as to better
and more efficiently find frame boundaries

Fixes: Timeout
Fixes: 9210/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PBM_fuzzer-4770771833454592
Fixes: 9214/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PPM_fuzzer-5741633353023488
Fixes: 9219/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGM_fuzzer-6249230237696000
Fixes: 9550/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PAM_fuzzer-5312669836902400

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1940c27c8272843f5139a25758fb92b1b1858cbe
---

 libavcodec/pnm_parser.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index bdd7f2b505..4bcd0ddd5d 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -51,8 +51,9 @@ retry:
             if (pc->index) {
                 pc->index = 0;
             } else {
-                buf++;
-                buf_size--;
+                unsigned step = FFMAX(1, pnmctx.bytestream - pnmctx.bytestream_start);
+                buf      += step;
+                buf_size -= step;
             }
             goto retry;
         }



More information about the ffmpeg-cvslog mailing list