public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] kvx: fix kvx_reassemble_bundle index 8 out of bounds
@ 2023-08-24 10:36 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-08-24 10:36 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f1917fc63166d73a9d0930d96468e486a49c666d

commit f1917fc63166d73a9d0930d96468e486a49c666d
Author: Paul Iannetta <piannetta@kalrayinc.com>
Date:   Thu Aug 24 10:39:14 2023 +0200

    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.

Diff:
---
 opcodes/kvx-dis.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/opcodes/kvx-dis.c b/opcodes/kvx-dis.c
index 7fef4c7543d..ec9c7718b06 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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-24 10:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-24 10:36 [binutils-gdb] kvx: fix kvx_reassemble_bundle index 8 out of bounds Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).