Browse Source

GNU as 2.16.1-tigcc-4:
Fix buffer overflow when encountering unterminated strings.


git-svn-id: file:///var/svn/tigccpp/trunk@937 9552661e-59e3-4036-b4f2-dbe53926924f

kevinkofler 17 years ago
parent
commit
19995b0d48
2 changed files with 20 additions and 1 deletions
  1. 4 0
      tigcc/gcc/ChangeLog-gas-2.16.txt
  2. 16 1
      tigcc/gcc/gas-2.16-tigcc-patch.diff

+ 4 - 0
tigcc/gcc/ChangeLog-gas-2.16.txt

@@ -1,5 +1,9 @@
 Changelog of the TIGCC-local changes to Binutils (2.16 branch):
 
+2007-02-18  Kevin Kofler  <Kevin@tigcc.ticalc.org>
+
+        * read.c (next_char_of_string): Fix buffer overflow.
+
 2006-11-18  Kevin Kofler  <Kevin@tigcc.ticalc.org>
 
         * Backport from Binutils 2.17:

+ 16 - 1
tigcc/gcc/gas-2.16-tigcc-patch.diff

@@ -1321,7 +1321,7 @@ diff -Naur binutils-2.16.1.orig/gas/listing.c binutils-2.16.1-src/gas/listing.c
        switch (list->edict)
 diff -Naur binutils-2.16.1.orig/gas/read.c binutils-2.16.1-src/gas/read.c
 --- binutils-2.16.1.orig/gas/read.c	2005-04-13 20:58:40.000000000 +0200
-+++ binutils-2.16.1-src/gas/read.c	2005-07-01 00:40:16.000000000 +0200
++++ binutils-2.16.1-src/gas/read.c	2007-02-18 22:45:10.000000000 +0100
 @@ -40,6 +40,7 @@
  #include "obstack.h"
  #include "listing.h"
@@ -1370,6 +1370,21 @@ diff -Naur binutils-2.16.1.orig/gas/read.c binutils-2.16.1-src/gas/read.c
  #endif /* TC_CONS_FIX_NEW */
  #endif /* BFD_ASSEMBLER */
      }
+@@ -4638,6 +4654,14 @@
+ {
+   register unsigned int c;
+ 
++  /* (TIGCC 20070218) input_line_pointer can overflow, catch that. */
++  if (input_line_pointer >= buffer_limit)
++    {
++      buffer_limit = input_scrub_next_buffer (&input_line_pointer);
++      if (buffer_limit == 0)
++        return NOT_A_CHAR;
++    }
++
+   c = *input_line_pointer++ & CHAR_MASK;
+   switch (c)
+     {
 diff -Naur binutils-2.16.1.orig/gas/subsegs.c binutils-2.16.1-src/gas/subsegs.c
 --- binutils-2.16.1.orig/gas/subsegs.c	2005-03-03 12:47:44.000000000 +0100
 +++ binutils-2.16.1-src/gas/subsegs.c	2005-07-01 00:40:16.000000000 +0200