Bug 315061

Summary: Cproto segfaults when reading from stdin
Product: [Fedora] Fedora Reporter: Trond Danielsen <trond.danielsen>
Component: cprotoAssignee: Jindrich Novy <jnovy>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 7CC: dickey, pknirsch
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 4.7f-1.fc8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-16 02:12:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Trond Danielsen 2007-10-02 07:12:59 UTC
Description of problem:
Cproto segfaults when reading from stdin.

Version-Release number of selected component (if applicable):
Name   : cproto
Arch   : x86_64
Version: 4.7e
Release: 2.fc6

How reproducible:
Every time.

Steps to Reproduce:
1. Run the following command:
$ echo "#include <stdio.h>
int main(int argc, char *argv[]) { printf(\"hello world\n\"); }" | cproto

  

Additional info:
- I have not yet tested this on my i386 laptop, only on my x86_64 workstation.
- This works just fine:
$ echo "#include <stdio.h>
int main(int argc, char *argv[]) { printf(\"hello world\n\"); }" >hello.c;
cproto hello.c
- gdb backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x0000000000407439 in get_cpp_directive (copy=1) at ./lex.l:726
726             *temp_buf = '\0';
(gdb) backtrace 
#0  0x0000000000407439 in get_cpp_directive (copy=1) at ./lex.l:726
#1  0x00000000004080c3 in yylex () at ./lex.l:175
#2  0x0000000000409709 in yyparse () at y.tab.c:877
#3  0x000000000040acdb in process_file (infile=<value optimized out>,
name=0x40b65d "stdin") at ./grammar.y:1011
#4  0x0000000000402348 in main (argc=1, argv=0x7fff97c14078) at cproto.c:821
#5  0x000000373681dab4 in __libc_start_main (main=0x401910 <main>, argc=1,
ubp_av=0x7fff97c14078, 
    init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value
optimized out>, 
    stack_end=0x7fff97c14068) at libc-start.c:222
#6  0x00000000004012c9 in _start ()

Comment 1 Jindrich Novy 2007-10-19 12:53:10 UTC
Fixed in rawhide, thanks for noticing. BTW. this happens exclusively for the
#include directive. The example code isn't compilable anyway ;-)

Comment 2 Thomas E. Dickey 2008-01-06 19:49:05 UTC
I added a fix in 4.7f

Comment 3 Trond Danielsen 2008-02-06 07:41:03 UTC
I confirm that the problem is gone in 4.7f.

Comment 4 Jindrich Novy 2008-02-14 07:19:03 UTC
Ok, I'll release fedora updates then. Thanks!

Comment 5 Fedora Update System 2008-02-14 13:13:42 UTC
cproto-4.7f-1.fc8 has been submitted as an update for Fedora 8

Comment 6 Fedora Update System 2008-02-14 13:15:41 UTC
cproto-4.7f-1.fc7 has been submitted as an update for Fedora 7

Comment 7 Fedora Update System 2008-02-16 02:12:37 UTC
cproto-4.7f-1.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2008-02-16 02:13:51 UTC
cproto-4.7f-1.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.