[FFmpeg-cvslog] r26292 - trunk/libavcodec/pnm.c

cehoyos subversion
Mon Jan 10 01:42:58 CET 2011


Author: cehoyos
Date: Mon Jan 10 01:42:57 2011
New Revision: 26292

Log:
Check for invalid maxval in pgm decoder, fixes issue 2518.

Patch by Daniel Kang, daniel.d.kang at gmail

Modified:
   trunk/libavcodec/pnm.c

Modified: trunk/libavcodec/pnm.c
==============================================================================
--- trunk/libavcodec/pnm.c	Mon Jan 10 00:01:01 2011	(r26291)
+++ trunk/libavcodec/pnm.c	Mon Jan 10 01:42:57 2011	(r26292)
@@ -140,6 +140,10 @@ int ff_pnm_decode_header(AVCodecContext 
     if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {
         pnm_get(s, buf1, sizeof(buf1));
         s->maxval = atoi(buf1);
+        if (s->maxval <= 0) {
+            av_log(avctx, AV_LOG_ERROR, "Invalid maxval: %d\n", s->maxval);
+            return -1;
+        }
         if (s->maxval >= 256) {
             if (avctx->pix_fmt == PIX_FMT_GRAY8) {
                 avctx->pix_fmt = PIX_FMT_GRAY16BE;



More information about the ffmpeg-cvslog mailing list