Skip to content

Commit 58cf31c

Browse files
committed
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: wuninsu@gmail.com Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
1 parent 880b299 commit 58cf31c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: libavcodec/x86/mpegvideodsp.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ static void gmc_mmx(uint8_t *dst, uint8_t *src,
5252
const int dyh = (dyy - (1 << (16 + shift))) * (h - 1);
5353
const int dxh = dxy * (h - 1);
5454
const int dyw = dyx * (w - 1);
55-
int need_emu = (unsigned) ix >= width - w ||
56-
(unsigned) iy >= height - h;
55+
int need_emu = (unsigned) ix >= width - w || width < w ||
56+
(unsigned) iy >= height - h || height< h
57+
;
5758

5859
if ( // non-constant fullpel offset (3% of blocks)
5960
((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) |

0 commit comments

Comments
 (0)