Do not stop decoding on pnm files with negative maxval.
authorCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>
Mon, 10 Jan 2011 22:09:52 +0000 (22:09 +0000)
committerCarl Eugen Hoyos <cehoyos@rainbow.studorg.tuwien.ac.at>
Mon, 10 Jan 2011 22:09:52 +0000 (22:09 +0000)
Originally committed as revision 26304 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/pnm.c

index 43438b7..c104e23 100644 (file)
@@ -142,7 +142,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
         s->maxval = atoi(buf1);
         if (s->maxval <= 0) {
             av_log(avctx, AV_LOG_ERROR, "Invalid maxval: %d\n", s->maxval);
-            return -1;
+            s->maxval = 255;
         }
         if (s->maxval >= 256) {
             if (avctx->pix_fmt == PIX_FMT_GRAY8) {