aboutsummaryrefslogtreecommitdiff
path: root/opcodes/crx-dis.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-26 16:04:20 +1030
committerAlan Modra <amodra@gmail.com>2019-12-26 17:49:03 +1030
commit100b122fc125bdf1fe768a3331a0cd413c3d1261 (patch)
tree59ee78d2faea1c0f5ae48595418fdb7a1ba0fcba /opcodes/crx-dis.c
parent6c2ca6c25dbefd7192dac52e7fd156ae0f299f1f (diff)
downloadfsf-binutils-gdb-100b122fc125bdf1fe768a3331a0cd413c3d1261.zip
fsf-binutils-gdb-100b122fc125bdf1fe768a3331a0cd413c3d1261.tar.gz
fsf-binutils-gdb-100b122fc125bdf1fe768a3331a0cd413c3d1261.tar.bz2
ubsan: crx: index 5 out of bounds for type 'operand_desc const[5]'
* crx-dis.c (get_number_of_operands): Don't access operands[] out of bounds.
Diffstat (limited to 'opcodes/crx-dis.c')
-rw-r--r--opcodes/crx-dis.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/opcodes/crx-dis.c b/opcodes/crx-dis.c
index 3834748..e44fca1 100644
--- a/opcodes/crx-dis.c
+++ b/opcodes/crx-dis.c
@@ -105,7 +105,7 @@ get_number_of_operands (void)
{
int i;
- for (i = 0; instruction->operands[i].op_type && i < MAX_OPERANDS; i++)
+ for (i = 0; i < MAX_OPERANDS && instruction->operands[i].op_type; i++)
;
return i;