fix oss-fuzz issue 10578. (#1159)

This commit is contained in:
Chen Huitao 2019-12-29 00:14:05 +08:00 committed by Nguyen Anh Quynh
parent 3cea38bff7
commit 95890d593f

View File

@ -2037,10 +2037,14 @@ static inline unsigned pcmpxstrx(CPUX86State *env, Reg *d, Reg *s,
} }
break; break;
case 3: case 3:
if (validd == -1) {
res = (2 << upper) - 1;
break;
}
for (j = valids - validd; j >= 0; j--) { for (j = valids - validd; j >= 0; j--) {
res <<= 1; res <<= 1;
v = 1; v = 1;
for (i = MIN(upper - j, validd); i >= 0; i--) { for (i = validd; i >= 0; i--) {
v &= (pcmp_val(s, ctrl, i + j) == pcmp_val(d, ctrl, i)); v &= (pcmp_val(s, ctrl, i + j) == pcmp_val(d, ctrl, i));
} }
res |= v; res |= v;