aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-29 01:04:05 +0300
committerLuca Barbato <lu_zero@gentoo.org>2013-10-04 03:52:11 +0200
commit3ac156b707932e93ed5e1f23ca866e251fafb743 (patch)
tree25a8ee7611b8cbde361853beea0a362012c3e062
parent09ace619d6ccb2c0a45b5fdead29f926409fa129 (diff)
downloadffmpeg-3ac156b707932e93ed5e1f23ca866e251fafb743.tar.gz
xxan: Disallow odd width
Decoded data is always written in pairs within this decoder. This fixes writes out of bounds. Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st> (cherry picked from commit aa0dd52434768da64f1f3d8ae92bcf980c1adffc) Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--libavcodec/xxan.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c
index 84ffdecdff..7a0cdc48c6 100644
--- a/libavcodec/xxan.c
+++ b/libavcodec/xxan.c
@@ -49,6 +49,10 @@ static av_cold int xan_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "Invalid frame height: %d.\n", avctx->height);
return AVERROR(EINVAL);
}
+ if (avctx->width & 1) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame width: %d.\n", avctx->width);
+ return AVERROR(EINVAL);
+ }
s->buffer_size = avctx->width * avctx->height;
s->y_buffer = av_malloc(s->buffer_size);