From ff07ec143ebd3833fd5a3f4b6c00474ac523a31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Sun, 29 Sep 2013 18:39:52 +0300 Subject: [PATCH] pcx: Return an error on broken palette if err_detect is set to 'explode' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/pcx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index 837f268efa..05a8f7c3fb 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -171,7 +171,8 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (buf_size < 769) { av_log(avctx, AV_LOG_ERROR, "File is too short\n"); - ret = buf_size; + ret = avctx->err_recognition & AV_EF_EXPLODE ? + AVERROR_INVALIDDATA : buf_size; goto end; } @@ -187,7 +188,8 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } if (*buf++ != 12) { av_log(avctx, AV_LOG_ERROR, "expected palette after image data\n"); - ret = buf_size; + ret = avctx->err_recognition & AV_EF_EXPLODE ? + AVERROR_INVALIDDATA : buf_size; goto end; } } else if (nplanes == 1) { /* all packed formats, max. 16 colors */