]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas: don't recognize '8' and '9' as octal escape chars in strings
authorJan Beulich <jbeulich@suse.com>
Fri, 17 Jul 2026 07:23:35 +0000 (09:23 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 17 Jul 2026 07:23:35 +0000 (09:23 +0200)
It's not clear why these were covered; it has been like this from the very
beginning of (available) source history. Yet more oddly, an old ia64
testcase actually uses such malformed escape sequences (which are being
adjusted).

gas/read.c
gas/testsuite/gas/ia64/alias.s

index 1a7537ba2a19e684030efc591513854800ba5160..ae481007c323c367fc50b102410e5a6dab1908a3 100644 (file)
@@ -6221,14 +6221,12 @@ next_char_of_string (void)
        case '5':
        case '6':
        case '7':
-       case '8':
-       case '9':
          {
            unsigned number;
            int i;
 
            for (i = 0, number = 0;
-                ISDIGIT (c) && i < 3;
+                i < 3 && c >= '0' && c <= '7';
                 c = *input_line_pointer++, i++)
              {
                number = number * 8 + c - '0';
index 9ac18014fa64ba3f094acfd954c0c01173e9dd1a..d54f69fbed0a008b219e552a9801bce1f9ff30ee 100644 (file)
@@ -1,11 +1,11 @@
        .section .foo,"aw","progbits"
        .secalias .foo,"1234"
        .secalias .foo,"1234"
-       .alias foo, "\"\80\84\""
-       .alias foo, "\"\80\84\""
+       .alias foo, "\"\100\104\""
+       .alias foo, "\"\100\104\""
 foo:
-       stringz "\"\80\84\""
+       stringz "\"\x40\x44\""
        .secalias .foo,"1234"
        .secalias .foo,"1234"
-       .alias foo, "\"\80\84\""
-       .alias foo, "\"\80\84\""
+       .alias foo, "\"\x40\x44\""
+       .alias foo, "\"\x40\x44\""