[binutils-gdb] arm: fix array-out-of-bounds upon register parsing error

Jan Beulich jbeulich@sourceware.org
Thu Jun 10 10:40:33 GMT 2021


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

commit e925962f4e5767a1d1d43fd3876564912ba807e1
Author: Jan Beulich <jbeulich@suse.com>
Date:   Thu Jun 10 12:39:40 2021 +0200

    arm: fix array-out-of-bounds upon register parsing error
    
    Despite the comment ahead of the enum explicitly pointing out the need
    to also update the corresponding array, 1b8833198c0 ("Add support for
    MVE instructions: vcmp and vpt") failed to do so. Oddly enough the issue
    appears to be spotted only by rather old gcc (4.3-ish in my case).

Diff:
---
 gas/ChangeLog       | 4 ++++
 gas/config/tc-arm.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 7133c374235..ab12ba558f1 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-10  Jan Beulich  <jbeulich@suse.com>
+
+	* config/tc-arm.c (reg_expected_msgs): Add REG_TYPE_ZR entry.
+
 2021-06-10  Jan Beulich  <jbeulich@suse.com>
 
 	* config/tc-i386.c (optimize_encoding): Suppress LEA conversion
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 1e2ac65d422..895718c9920 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -729,7 +729,8 @@ const char * const reg_expected_msgs[] =
   [REG_TYPE_MMXWCG] = N_("iWMMXt scalar register expected"),
   [REG_TYPE_XSCALE] = N_("XScale accumulator register expected"),
   [REG_TYPE_MQ]	    = N_("MVE vector register expected"),
-  [REG_TYPE_RNB]    = ""
+  [REG_TYPE_RNB]    = "",
+  [REG_TYPE_ZR]     = N_("ZR register expected"),
 };
 
 /* Some well known registers that we refer to directly elsewhere.  */


More information about the Binutils-cvs mailing list