aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-01-08 11:42:36 +1030
committerAlan Modra <amodra@gmail.com>2020-01-08 21:51:32 +1030
commit030a2e78acf66c5c12e073ec3887a167da7a7195 (patch)
treea96dc0b6fda94acff746f176f72c21aa2beed27d /gas
parent4c6ee6465acc58f0f86c44668c4e862901186239 (diff)
downloadgdb-030a2e78acf66c5c12e073ec3887a167da7a7195.zip
gdb-030a2e78acf66c5c12e073ec3887a167da7a7195.tar.gz
gdb-030a2e78acf66c5c12e073ec3887a167da7a7195.tar.bz2
ubsan: z8k: index 10 out of bounds for type 'unsigned int const[10]'
The fix is the additional ARRAY_SIZE test, the rest just tidies variable types rather than adding a cast to avoid warnings. opcodes/ * z8k-dis.c: Include libiberty.h (instr_data_s): Make max_fetched unsigned. (z8k_lookup_instr): Make nibl_index and tabl_index unsigned. Don't exceed byte_info bounds. (output_instr): Make num_bytes unsigned. (unpack_instr): Likewise for nibl_count and loop. * z8kgen.c (gas <opcode_entry_type>): Make noperands, length and idx unsigned. * z8k-opc.h: Regenerate. gas/ * config/tc-z8k.c (md_begin): Make idx unsigned. (get_specific): Likewise for this_index.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-z8k.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 1c61732..46ce02e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-08 Alan Modra <amodra@gmail.com>
+
+ * config/tc-z8k.c (md_begin): Make idx unsigned.
+ (get_specific): Likewise for this_index.
+
2020-01-07 Claudiu Zissulescu <claziss@synopsys.com>
* onfig/tc-arc.c (parse_reloc_symbol): New function.
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index d61a51f..ea4ee3a 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -143,7 +143,7 @@ void
md_begin (void)
{
const opcode_entry_type *opcode;
- int idx = -1;
+ unsigned int idx = -1u;
opcode_hash_control = hash_new ();
@@ -861,7 +861,7 @@ get_specific (opcode_entry_type *opcode, op_type *operands)
int found = 0;
unsigned int noperands = opcode->noperands;
- int this_index = opcode->idx;
+ unsigned int this_index = opcode->idx;
while (this_index == opcode->idx && !found)
{