[FFmpeg-devel] [PATCH] pnm parser crashes on corrupted frames

Jai Menon jmenon86
Sat Mar 27 22:23:37 CET 2010


On Sun, Mar 28, 2010 at 2:46 AM, Howard Chu <hyc at highlandsun.com> wrote:
> While using gource http://code.google.com/p/gource/ to generate a movie it
> looks like occasionally some corrupted frames get spit out, and these can
> cause ffmpeg to SEGV. This simple patch avoids one of the crash situations.

[...]

>     avctx->height = atoi(buf1);
>+   if (avctx->height <= 0)
>+       return -1;
>     if(avcodec_check_dimensions(avctx, avctx->width, avctx->height))
>        return -1;
>     if (avctx->pix_fmt != PIX_FMT_MONOWHITE) {

maybe change the below check to:

if(avcodec_check_dimensions(avctx, avctx->width, avctx->height) < 0)
    return -1;

instead of this,

-- 
Jai Menon



More information about the ffmpeg-devel mailing list