diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c index e311b2ef75..ab20cf558f 100644 --- a/libavcodec/pnmenc.c +++ b/libavcodec/pnmenc.c @@ -69,8 +69,8 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, n = avctx->width * 6; break; case AV_PIX_FMT_YUV420P: - if (avctx->width & 1) { - av_log(avctx, AV_LOG_ERROR, "pgmyuv needs even width\n"); + if (avctx->width & 1 || avctx->height & 1) { + av_log(avctx, AV_LOG_ERROR, "pgmyuv needs even width and height\n"); return AVERROR(EINVAL); } c = '5';