This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Prevent seg-fault in gas reading a binary input file.


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

commit 3be64886b5cd7e877d8783a53b81e2c6f7d01307
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Feb 19 13:19:57 2016 +0000

    Prevent seg-fault in gas reading a binary input file.
    
    	PR 19630
    	* read.c (read_a_source_file): Check for assemble_one returning
    	with input_line_pointer set to NULL.

Diff:
---
 gas/ChangeLog | 6 ++++++
 gas/read.c    | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index b1637a3..d97a4b7 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-19  Nick Clifton  <nickc@redhat.com>
+
+	PR 19630
+	* read.c (read_a_source_file): Check for assemble_one returning
+	with input_line_pointer set to NULL.
+
 016-02-19  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
 
 	* listing.c (rebuffer_line): Change return type to void.
diff --git a/gas/read.c b/gas/read.c
index 22da1df..5e0e3c8 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -1176,6 +1176,11 @@ read_a_source_file (char *name)
 
 		      assemble_one (s); /* Assemble 1 instruction.  */
 
+		      /* PR 19630: The backend may have set ilp to NULL
+			 if it encountered a catastrophic failure.  */
+		      if (input_line_pointer == NULL)
+			as_fatal (_("unable to continue with assembly."));
+ 
 		      *input_line_pointer++ = nul_char;
 
 		      /* We resume loop AFTER the end-of-line from


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]