aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2013-09-29 01:04:05 +0300
committerMartin Storsjö <martin@martin.st>2013-09-29 20:02:32 +0300
commitaa0dd52434768da64f1f3d8ae92bcf980c1adffc (patch)
tree991b305a968b743791fa16caeb5418da4d04255e /libavcodec
parentfc739b3eefa0b58d64e7661621da94a94dbc8a82 (diff)
downloadffmpeg-aa0dd52434768da64f1f3d8ae92bcf980c1adffc.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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/xxan.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c
index 2bc9ff697b..05ce7ffae6 100644
--- a/libavcodec/xxan.c
+++ b/libavcodec/xxan.c
@@ -50,6 +50,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);