diff options
author | Alan Modra <amodra@gmail.com> | 2023-03-31 15:19:10 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2023-04-03 07:43:14 +0930 |
commit | f679aaa4c8fd6f72a8e2d60aba2c88127133101a (patch) | |
tree | f1eb0c968bf8674804630f0ab6294e4014251bd5 /gas | |
parent | a6336913332303c45608d77b731bee5c3a3095e0 (diff) | |
download | binutils-f679aaa4c8fd6f72a8e2d60aba2c88127133101a.zip binutils-f679aaa4c8fd6f72a8e2d60aba2c88127133101a.tar.gz binutils-f679aaa4c8fd6f72a8e2d60aba2c88127133101a.tar.bz2 |
ubsan: aarch64 parse_vector_reg_list
tc-aarch64.c:1473:27: runtime error: left shift of 7 by 30 places
cannot be represented in type 'int'.
* config/tc-aarch64.c (parse_vector_reg_list): Avoid UB left
shift.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/tc-aarch64.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c index 747cf37..99fb5de 100644 --- a/gas/config/tc-aarch64.c +++ b/gas/config/tc-aarch64.c @@ -1393,7 +1393,7 @@ parse_vector_reg_list (char **ccp, aarch64_reg_type type, char *str = *ccp; int nb_regs; struct vector_type_el typeinfo, typeinfo_first; - int val, val_range, mask; + uint32_t val, val_range, mask; int in_range; int ret_val; bool error = false; @@ -1414,8 +1414,8 @@ parse_vector_reg_list (char **ccp, aarch64_reg_type type, typeinfo_first.element_size = 0; typeinfo_first.index = 0; ret_val = 0; - val = -1; - val_range = -1; + val = -1u; + val_range = -1u; in_range = 0; mask = reg_type_mask (type); do @@ -1470,7 +1470,7 @@ parse_vector_reg_list (char **ccp, aarch64_reg_type type, if (! error) for (;;) { - ret_val |= val_range << (5 * nb_regs); + ret_val |= val_range << ((5 * nb_regs) & 31); nb_regs++; if (val_range == val) break; |