Merge pull request #14017 from glebm/fix-ubsan-neg-shift-mips-code-utils

Fix left shift of negative value in MIPSCodeUtils
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2021-01-30 15:32:10 +01:00
commit a367191b9f
1 file changed
+3 -3
+3 -3
View File
@@ -55,7 +55,7 @@ namespace MIPSCodeUtils
MIPSInfo info = MIPSGetInfo(op);
if (info & IS_CONDBRANCH)
{
return addr + 4 + ((signed short)(op&0xFFFF)<<2);
return addr + 4 + ((signed short)((op&0xFFFF)<<2));
}
else
return INVALIDTARGET;
@@ -77,7 +77,7 @@ namespace MIPSCodeUtils
MIPSInfo info = MIPSGetInfo(op);
if ((info & IS_CONDBRANCH) && !(info & OUT_RA))
{
return addr + 4 + ((signed short)(op&0xFFFF)<<2);
return addr + 4 + ((signed short)((op&0xFFFF)<<2));
}
else
return INVALIDTARGET;
@@ -125,7 +125,7 @@ namespace MIPSCodeUtils
}
if (sure && takeBranch)
return addr + 4 + ((signed short)(op&0xFFFF)<<2);
return addr + 4 + ((signed short)((op&0xFFFF)<<2));
else if (sure && !takeBranch)
return addr + 8;
else