[FFmpeg-devel] [PATCH]Fix crash when reading gray pam

Derek Buitenhuis derek.buitenhuis at gmail.com
Wed Dec 28 04:39:13 CET 2011


On 27/12/2011 7:18 PM, Carl Eugen Hoyos wrote:
> diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
> index dfc18d6..b52cd27 100644
> --- a/libavcodec/pnm.c
> +++ b/libavcodec/pnm.c
> @@ -107,6 +107,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
>
>           avctx->width  = w;
>           avctx->height = h;
> +        s->maxval     = maxval;
>           if (depth == 1) {
>               if (maxval == 1)
>                   avctx->pix_fmt = PIX_FMT_MONOWHITE;

This indeed does seem to fix the problem, and looks pretty OK to me.

However, I am wondering...

The PAM file generated by FFmpeg cannot even be opened by Photoshop
or The GIMP. I'm wondering if FFmpeg is outputting invalid PAM...

- Derek


More information about the ffmpeg-devel mailing list