Bug 9465 - tradcpp0 segfaults on nul bytes
Summary: tradcpp0 segfaults on nul bytes
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 3.2.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-27 20:46 UTC by adl
Modified: 2003-07-25 17:33 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description adl 2003-01-27 20:46:00 UTC
`tradcpp0' segfaults on nul bytes.

When Debian switched to gcc-3.2 my applications' X resources
stopped being honored.  It turns out that `xrdb' processes
its input with `cpp -traditional' and I had a useless nul byte
at the end of my .Xresources.

I can reproduce this segfault with 3.1.  It works fine with 2.95.

Release:
cpp (GCC) 3.2.2 20030124 (Debian prerelease)

Environment:
Debian unstable

How-To-Repeat:
Create a file containing a nul byte, and run it through
the traditional preproc.

% echo '\0' > bar
% od -c bar
0000000  \0  \n
0000002
~ % cpp bar
# 1 "bar"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "bar"
bar:1:1: warning: null character(s) ignored
~ % cpp -traditional bar
cpp: Internal error: Segmentation fault (program tradcpp0)
Please submit a full bug report.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
For Debian GNU/Linux specific bugs,
please see /usr/share/doc/debian/bug-reporting.txt.

~ % cpp --version
cpp (GCC) 3.2.2 20030124 (Debian prerelease)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Comment 1 Neil Booth 2003-01-27 22:08:13 UTC
From: Neil Booth <neil@daikokuya.co.uk>
To: Alexandre Duret-Lutz <adl@gnu.org>
Cc: gcc-gnats@gcc.gnu.org, Jakub Jelinek <jakub@redhat.com>,
	gcc-bugs@gcc.gnu.org
Subject: Re: preprocessor/9465: tradcpp0 segfaults on nul bytes
Date: Mon, 27 Jan 2003 22:08:13 +0000

 Alexandre Duret-Lutz wrote:-
 
 > >Originator:     Alexandre Duret-Lutz
 > >Release:        cpp (GCC) 3.2.2 20030124 (Debian prerelease)
 > >Organization:
 > >Environment:
 > Debian unstable
 > >Description:
 > `tradcpp0' segfaults on nul bytes.
 > 
 > When Debian switched to gcc-3.2 my applications' X resources
 > stopped being honored.  It turns out that `xrdb' processes
 > its input with `cpp -traditional' and I had a useless nul byte
 > at the end of my .Xresources.
 > 
 > I can reproduce this segfault with 3.1.  It works fine with 2.95.
 > >How-To-Repeat:
 > Create a file containing a nul byte, and run it through
 > the traditional preproc.
 > 
 > % echo '\0' > bar
 > % od -c bar
 > 0000000  \0  \n
 > 0000002
 > ~ % cpp bar
 > # 1 "bar"
 > # 1 "<built-in>"
 > # 1 "<command line>"
 > # 1 "bar"
 > bar:1:1: warning: null character(s) ignored
 > ~ % cpp -traditional bar
 > cpp: Internal error: Segmentation fault (program tradcpp0)
 
 Jakub, this is the second report of this regression you introduced.
 
 Do you intend to fix it?
 
 Neil.

Comment 2 Jakub Jelinek 2003-02-01 21:48:43 UTC
From: jakub@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: preprocessor/9465
Date: 1 Feb 2003 21:48:43 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-rhl8-branch
 Changes by:	jakub@gcc.gnu.org	2003-02-01 21:48:43
 
 Modified files:
 	gcc            : ChangeLog tradcpp.c 
 
 Log message:
 	PR preprocessor/9465
 	* tradcpp.c (fixup_newlines): Use memchr instead of strchr.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.13152.2.657.2.27.2.60&r2=1.13152.2.657.2.27.2.61
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tradcpp.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-rhl8-branch&r1=1.47.2.2.4.1&r2=1.47.2.2.4.2
 

Comment 3 Jakub Jelinek 2003-02-02 12:59:59 UTC
From: jakub@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: preprocessor/9465
Date: 2 Feb 2003 12:59:59 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	jakub@gcc.gnu.org	2003-02-02 12:59:58
 
 Modified files:
 	gcc            : ChangeLog tradcpp.c 
 
 Log message:
 	PR preprocessor/9465
 	* tradcpp.c (fixup_newlines): Use memchr instead of strchr.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.208&r2=1.13152.2.657.2.209
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tradcpp.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.47.2.2.2.1&r2=1.47.2.2.2.2
 
Comment 4 Neil Booth 2003-02-02 21:32:47 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Fixed in 3.2.2.