This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: fix seg fault in cppmain
- From: Don Lindsay <lindsayd at cisco dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 23 Nov 2001 15:12:11 -0800 (PST)
- Subject: [PATCH]: fix seg fault in cppmain
I don't have CVS privs, so if someone wants to run with this:
Relative to the 3.0.2 tarball:
A seg fault can be caused by the following legal test:
echo "main(){}" > foo.c
gcc -dD -M foo.c
The following is the most obvious fix. The routines involved
weren't in 2.95.3, so this bug has no history.
Fri Nov 23 14:57:53 2001 Don Lindsay <lindsayd@cisco.com>
* cppmain.c (printer_init): Init print.last_fname to "" not 0.
This prevents print_line from using a null pointer.
Index: cppmain.c
===================================================================
RCS file: /home/cvs/gcc-c302/gnu/gcc-3.0.2/gcc/cppmain.c,v
retrieving revision 1.1.1.1
diff -c -2 -p -r1.1.1.1 cppmain.c
*** cppmain.c 2001/11/10 23:50:33 1.1.1.1
--- cppmain.c 2001/11/23 23:00:27
*************** printer_init (pfile)
*** 275,279 ****
cpp_reader *pfile;
{
! print.last_fname = 0;
print.lineno = 0;
print.printed = 0;
--- 275,279 ----
cpp_reader *pfile;
{
! print.last_fname = "";
print.lineno = 0;
print.printed = 0;