[binutils-gdb] Fix seg fault attempting to unget an EOF character.

Nick Clifton nickc@sourceware.org
Thu Dec 1 15:20:00 GMT 2016


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

commit 69ace2200106348a1b00d509a6a234337c104c17
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Dec 1 15:20:19 2016 +0000

    Fix seg fault attempting to unget an EOF character.
    
    	PR gas/20898
    	* app.c (do_scrub_chars): Do not attempt to unget EOF.

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

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 76c23ce..a142857 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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.
diff --git a/gas/app.c b/gas/app.c
index 6b883a1..dcd8219 100644
--- 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);
 		}



More information about the Binutils-cvs mailing list