aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorPaul Iannetta <piannetta@kalrayinc.com>2023-08-24 10:39:14 +0200
committerAlan Modra <amodra@gmail.com>2023-08-24 20:03:23 +0930
commitf1917fc63166d73a9d0930d96468e486a49c666d (patch)
tree54d62e13c6cf4c252b0a968600a91ead0bd2fe0f /opcodes
parent476dd29dc60b6dc3aec0e29ce2150202cf85f7a8 (diff)
downloadgdb-f1917fc63166d73a9d0930d96468e486a49c666d.zip
gdb-f1917fc63166d73a9d0930d96468e486a49c666d.tar.gz
gdb-f1917fc63166d73a9d0930d96468e486a49c666d.tar.bz2
kvx: fix kvx_reassemble_bundle index 8 out of bounds
opcodes/ * kvx-dis.c (print_insn_kvx): Change the loop condition so that wordcount is always less than KVXMAXBUNDLEWORDS. (decode_prologue_epilogue_bundle): Likewise.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/kvx-dis.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/opcodes/kvx-dis.c b/opcodes/kvx-dis.c
index 7fef4c7..ec9c771 100644
--- a/opcodes/kvx-dis.c
+++ b/opcodes/kvx-dis.c
@@ -1056,7 +1056,7 @@ print_insn_kvx (bfd_vma memaddr, struct disassemble_info *info)
wordcount++;
}
while (kvx_has_parallel_bit (bundle_words[wordcount - 1])
- && wordcount < KVXMAXBUNDLEWORDS);
+ && wordcount < KVXMAXBUNDLEWORDS - 1);
invalid_bundle = kvx_reassemble_bundle (wordcount, &insncount);
}
@@ -1238,7 +1238,7 @@ decode_prologue_epilogue_bundle (bfd_vma memaddr,
nb_syl++;
}
while (kvx_has_parallel_bit (bundle_words[nb_syl - 1])
- && nb_syl < KVXMAXBUNDLEWORDS);
+ && nb_syl < KVXMAXBUNDLEWORDS - 1);
if (kvx_reassemble_bundle (nb_syl, &nb_insn))
return -1;