bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/22737] [RX] rx_start_line wrongly modifies LTO data


From: olegendo at gcc dot gnu.org
Subject: [Bug gas/22737] [RX] rx_start_line wrongly modifies LTO data
Date: Sat, 20 Jan 2018 11:36:18 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=22737

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nickc at redhat dot com

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
In the problematic .s file, there is a single occurrence of the magic sequence
"?:" that rx_start_line triggers on:

        .ascii  "\377\026\310\037h\"\320d\240?:\341O\332\016\214\266\306\234."

The function does not handle the \" escape sequence.
The following fixes it:

diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index 8e49ddd..df761b4 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -2681,6 +2681,7 @@ rx_start_line (void)
   int in_single_quote = 0;
   int done = 0;
   char * p = input_line_pointer;
+  char prev_char = 0;

   /* Scan the line looking for question marks.  Skip past quote enclosed
regions.  */
   do
@@ -2693,7 +2694,9 @@ rx_start_line (void)
          break;

        case '"':
-         in_double_quote = ! in_double_quote;
+         /* Handle escaped double quote \" inside a string.  */
+         if (prev_char != '\\')
+           in_double_quote = ! in_double_quote;
          break;

        case '\'':
@@ -2722,6 +2725,7 @@ rx_start_line (void)
          break;
        }

+      prev_char = *p;
       p ++;
     }
   while (! done);

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]