summaryrefslogtreecommitdiff
path: root/libavcodec/pnmenc.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-03-18 18:04:44 +0000
committerMichael Niedermayer <michaelni@gmx.at>2012-03-18 20:00:35 +0100
commita41340f8e85a13ec0b5a8a6bb93d09342adac047 (patch)
treebfac359010d4b23b2e93a3ee35dcff4e16bba3af /libavcodec/pnmenc.c
parenteb74e9ea10f64704ee45e5da7baf6c100a2a88f7 (diff)
pgmyuvenc: abort encoding if width is not even
Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pnmenc.c')
-rw-r--r--libavcodec/pnmenc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/pnmenc.c b/libavcodec/pnmenc.c
index b1f27b4a3e..eae859efb4 100644
--- a/libavcodec/pnmenc.c
+++ b/libavcodec/pnmenc.c
@@ -71,6 +71,10 @@ static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
n = avctx->width * 6;
break;
case PIX_FMT_YUV420P:
+ if (avctx->width & 1) {
+ av_log(avctx, AV_LOG_ERROR, "pgmyuv needs even width\n");
+ return AVERROR(EINVAL);
+ }
c = '5';
n = avctx->width;
h1 = (h * 3) / 2;