[FFmpeg-cvslog] lavc/pnm_parser: disable parsing for text based PNMs

Clément Bœsch git at videolan.org
Wed Jun 29 11:01:39 CEST 2016


ffmpeg | branch: release/3.1 | Clément Bœsch <clement at stupeflix.com> | Mon Jun 27 17:54:22 2016 +0200| [25f0ea9ece79ddd11f333acde38849e8c46543f5] | committer: Matthieu Bouron

lavc/pnm_parser: disable parsing for text based PNMs

P1, P2, and P3 are respectively the text versions of PBM, PGM and PPM
files.

We can not obtain the buffer size using av_imgage_get_buffer_size() as
every pixel in the picture will occupy a random size between 16 and 32
bits ("4 " and "231 " are such example).

Ideally, we could look for the next header (or EOF) in the bytestream,
but this commit is meant to fix a decoding regression introduced by
48ac4532d437790e56b8ed5d0d467dc88685f035.

Fix Ticket #5670

(cherry picked from commit c5566f0a944e376b39c8f994659060ca036c441d)

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

 libavcodec/pnm_parser.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index a7d70b9..43dbfc7 100644
--- a/libavcodec/pnm_parser.c
+++ b/libavcodec/pnm_parser.c
@@ -66,6 +66,8 @@ retry:
         }
 #endif
         next = END_NOT_FOUND;
+    } else if (pnmctx.type < 4) {
+        next = END_NOT_FOUND;
     } else {
         next = pnmctx.bytestream - pnmctx.bytestream_start
                + av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1);



More information about the ffmpeg-cvslog mailing list