summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <[email protected]>2017-11-13 20:47:48 +0100
committerMichael Niedermayer <[email protected]>2017-12-30 21:11:31 +0100
commit96fe37a3390aaa07a1798d8daa6aa2d622c4870b (patch)
tree586e15c490fce4d2e6f11d83d4bb4ffe4e8a0cc1
parentb3067f95c9802a1219abe7dea3aa93419c8cc0f7 (diff)
avcodec/x86/mpegvideodsp: Fix signedness bug in need_emu
Fixes: out of array read Fixes: 3516/attachment-311488.dat Found-by: Insu Yun, Georgia Tech. Tested-by: [email protected] Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit 58cf31cee7a456057f337b3102a03206d833d5e8) Signed-off-by: Michael Niedermayer <[email protected]>
-rw-r--r--libavcodec/x86/mpegvideodsp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/x86/mpegvideodsp.c b/libavcodec/x86/mpegvideodsp.c
index e0498f3849..6009b64e07 100644
--- a/libavcodec/x86/mpegvideodsp.c
+++ b/libavcodec/x86/mpegvideodsp.c
@@ -52,8 +52,9 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src,
const int dyh = (dyy - (1 << (16 + shift))) * (h - 1);
const int dxh = dxy * (h - 1);
const int dyw = dyx * (w - 1);
- int need_emu = (unsigned) ix >= width - w ||
- (unsigned) iy >= height - h;
+ int need_emu = (unsigned) ix >= width - w || width < w ||
+ (unsigned) iy >= height - h || height< h
+ ;
if ( // non-constant fullpel offset (3% of blocks)
((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) |