diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-05-07 20:33:33 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-05-07 20:33:46 +0200 |
commit | ead590c2561980f2afda38a662364659577dca38 (patch) | |
tree | 10d22f598636ea50faefd4ec15498001e61b98be /libavcodec/dxa.c | |
parent | f96e0eb2387f8da7b8177f8f22969853dc648ca6 (diff) | |
download | ffmpeg-ead590c2561980f2afda38a662364659577dca38.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>
Diffstat (limited to 'libavcodec/dxa.c')
-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 b2f9b81121..d30bfb2702 100644 --- a/libavcodec/dxa.c +++ b/libavcodec/dxa.c @@ -133,6 +133,11 @@ static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, 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]; |