summaryrefslogtreecommitdiff
path: root/libavcodec/pnm_parser.c
diff options
context:
space:
mode:
authorClément Bœsch <clement@stupeflix.com>2016-06-27 17:54:22 +0200
committerClément Bœsch <clement@stupeflix.com>2016-06-27 18:04:50 +0200
commitc5566f0a944e376b39c8f994659060ca036c441d (patch)
tree040b259af57e0b7f4d760bf551502d1aab8fbb19 /libavcodec/pnm_parser.c
parent0acc170aad995012da9610063b1f39e8f10eccf8 (diff)
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
Diffstat (limited to 'libavcodec/pnm_parser.c')
-rw-r--r--libavcodec/pnm_parser.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/pnm_parser.c b/libavcodec/pnm_parser.c
index a7d70b9931..43dbfc7f27 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);