Source-Changes-HG archive

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

[src/trunk]: src/external/gpl3/binutils/dist/gas When trying to scrub charact...



details:   https://anonhg.NetBSD.org/src/rev/3d4f9a47b429
branches:  trunk
changeset: 373257:3d4f9a47b429
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 27 23:36:04 2023 +0000

description:
When trying to scrub characters in a macro to convert:

    # 123 "foo.c" 1 -> .linefile 123"foo.c"1

check if there is space first. Otherwise give up.

On the vax it was trying to scrub:

    # 2672 "foo.c" 1
    emul %r2,%r0,$0,%r4
    # 0 "" 2

and ended up with an incomplete string:

    .linefile 2672"foo.c"1
    emul %r2,%r0,$0,%r4
    .
And then when the assembler tried to parse the next line after the emul
barfed with unknown pseudo-op .

diffstat:

 external/gpl3/binutils/dist/gas/app.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r 858985bc5c54 -r 3d4f9a47b429 external/gpl3/binutils/dist/gas/app.c
--- a/external/gpl3/binutils/dist/gas/app.c     Fri Jan 27 23:29:14 2023 +0000
+++ b/external/gpl3/binutils/dist/gas/app.c     Fri Jan 27 23:36:04 2023 +0000
@@ -410,7 +410,7 @@
 {
   char *to = tostart;
   char *toend = tostart + tolen;
-  char *from;
+  char *from, *savefrom;
   char *fromend;
   size_t fromlen;
   int ch, ch2 = 0;
@@ -1234,6 +1234,7 @@
             thought out.  On i386, we want '/' as line comment start
             AND we want C style comments.  hence this hack.  The
             whole lexical process should be reworked.  xoxorich.  */
+         savefrom = from;
          if (ch == '/')
            {
              ch2 = GET ();
@@ -1294,6 +1295,11 @@
                out_string = "\tlinefile ";
              else
                out_string = "\t.linefile ";
+             if (toend - to < strlen(out_string) + strlen(from) + 1)
+               {
+                 from = savefrom - 1;
+                 goto tofull;
+               }
              PUT (*out_string++);
              break;
            }



Home | Main Index | Thread Index | Old Index