1
0
forked from aniani/vim

patch 8.2.5006: asan warns for undefined behavior

Problem:    Asan warns for undefined behavior.
Solution:   Cast the shifted value to unsigned.
This commit is contained in:
Bram Moolenaar
2022-05-22 22:07:52 +01:00
parent 5b529230f1
commit 68e64d2c17
4 changed files with 6 additions and 3 deletions

View File

@@ -4091,7 +4091,7 @@ exec_instructions(ectx_T *ectx)
case EXPR_LSHIFT: if (arg2 > MAX_LSHIFT_BITS)
res = 0;
else
res = arg1 << arg2;
res = (uvarnumber_T)arg1 << arg2;
break;
case EXPR_RSHIFT: if (arg2 > MAX_LSHIFT_BITS)
res = 0;