diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-07 20:33:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-01-16 00:35:12 +0100 |
commit | 84b100396efb1d8ac65b2097ff1d9e532313d2d6 (patch) | |
tree | efca8a0e6b46c1d8c6cc7d3ef80342829150995f | |
parent | 7855083443e059503731371d0eab011ae573708c (diff) | |
download | ffmpeg-84b100396efb1d8ac65b2097ff1d9e532313d2d6.tar.gz |
dxa: check vectors of 2x2 motion blocks
Fixes out of array reads
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ead590c2561980f2afda38a662364659577dca38)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/dxa.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c index 97c30d5bd0..7bd74f3c74 100644 --- a/libavcodec/dxa.c +++ b/libavcodec/dxa.c @@ -133,6 +133,11 @@ static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint case 0x80: // motion compensation x = (*mv) >> 4; if(x & 8) x = 8 - x; y = (*mv++) & 0xF; if(y & 8) y = 8 - y; + if (i + 2*(k & 1) < -x || avctx->width - i - 2*(k & 1) - 2 < x || + j + (k & 2) < -y || avctx->height - j - (k & 2) - 2 < y) { + av_log(avctx, AV_LOG_ERROR, "MV %d %d out of bounds\n", x,y); + return AVERROR_INVALIDDATA; + } tmp2 += x + y*stride; case 0x00: // skip tmp[d + 0 ] = tmp2[0]; |