ubsan: z8k: index 10 out of bounds for type 'unsigned int const[10]'
authorAlan Modra <amodra@gmail.com>
Wed, 8 Jan 2020 01:12:36 +0000 (11:42 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 8 Jan 2020 11:21:32 +0000 (21:51 +1030)
commit030a2e78acf66c5c12e073ec3887a167da7a7195
treea96dc0b6fda94acff746f176f72c21aa2beed27d
parent4c6ee6465acc58f0f86c44668c4e862901186239
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.
gas/ChangeLog
gas/config/tc-z8k.c
opcodes/ChangeLog
opcodes/z8k-dis.c
opcodes/z8k-opc.h
opcodes/z8kgen.c