X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fpnm.c;h=dfc18d6013858771b674f809211f9e4497fbd0c9;hb=c137fdd778e1bb82c2f0d7fa4a88adc97058d6d4;hp=2cbbdf60ea96ad83a7c5562152db85e96fd8ff01;hpb=707e8612e85ba83fcbbfc56be3f4ab24af7e98fb;p=ffmpeg diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c index 2cbbdf60ea9..dfc18d60138 100644 --- a/libavcodec/pnm.c +++ b/libavcodec/pnm.c @@ -135,7 +135,7 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) return -1; pnm_get(s, buf1, sizeof(buf1)); avctx->height = atoi(buf1); - if(av_image_check_size(avctx->width, avctx->height, 0, avctx)) + if(avctx->height <= 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx)) return -1; if (avctx->pix_fmt != PIX_FMT_MONOWHITE) { pnm_get(s, buf1, sizeof(buf1));