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

Reimar Döffinger Reimar.Doeffinger
Mon Jan 10 08:19:48 CET 2011


On Mon, Jan 10, 2011 at 01:42:58AM +0100, cehoyos wrote:
> 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;

I think someone regularly requests to avoid the generic -1 return :-).
As long as we encounter no such files it probably isn't worth it,
but falling back to a default of 255 instead of failing might be more
robust and allow playing some more files.



More information about the ffmpeg-cvslog mailing list