Fix seg fault attempting to unget an EOF character.
authorNick Clifton <nickc@redhat.com>
Thu, 1 Dec 2016 15:20:19 +0000 (15:20 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 1 Dec 2016 15:20:19 +0000 (15:20 +0000)
PR gas/20898
* app.c (do_scrub_chars): Do not attempt to unget EOF.

gas/ChangeLog
gas/app.c

index 76c23ce70ca53e568f05dd4248d17f3c303e1070..a142857cba48281d0e5f503288bcc84ffa5d8f74 100644 (file)
@@ -1,5 +1,8 @@
 2016-12-01  Nick Clifton  <nickc@redhat.com>
 
+       PR gas/20898
+       * app.c (do_scrub_chars): Do not attempt to unget EOF.
+
        PR gas/20897
        * subsegs.c (subsegs_print_statistics): Do nothing if no output
        file was created.
index 6b883a1f8a164e232658b1e8c306e45a2e0cfa5e..dcd82191e07e705be20c9c3fc235ef7a5899a961 100644 (file)
--- a/gas/app.c
+++ b/gas/app.c
@@ -1188,7 +1188,7 @@ do_scrub_chars (size_t (*get) (char *, size_t), char *tostart, size_t tolen)
                  state = -2;
                  break;
                }
-             else
+             else if (ch2 != EOF)
                {
                  UNGET (ch2);
                }