Synopsis - Issue Tracker

Bug118 Editing

Title Segmentation fault for empty C++ files
Created on 2006-12-19.09:07:18 by littletux, last changed 2007-05-02.16:01:39 by blindvt.
assigned to stefan priority normal
type crash severity normal
components C parser platform GNU/Linux
status closed resolution fixed
depends on superseded by
Add Comment:
File
CC List:? littletux, stefan

Messages
Author: littletux Date: 2006-12-19.09:07:17
The C parser fails with a Segmentation Fault when called on an empty file:

$ touch empty.c
$ synopsis -p C -f HTML -o html_C empty.c

The attached patch handles this case.
Author: stefan Date: 2006-12-19.14:27:52
There are really two issues:

* The C (and Cxx) parsers need to deal with
  an empty input. That's what your patch
  addresses, and that happens to be already in
  the current code.

* The preprocessor didn't use to handle
  errors. That I just fixed, i.e. a failure
  in the Cpp parser will raise a 'Processor.Error'
  now.
Author: blindvt Date: 2007-05-02.16:01:38
Current trunk throws an (IMO invalid) error for empty C and Cxx files:

$ > empty.cc
$ synopsis -p C -o empty.C.syn empty.cc 
Error: ParseError: The input contains errors.
$ synopsis -p Cxx -o empty.Cxx.syn empty.cc 
terminate called after throwing an instance of 'std::runtime_error'
  what():  The input contains errors.
Aborted
Files
File nameUploaded
patch littletux, 2006-12-19.09:07:17
History
Date User Action Args
2006-12-19 09:07:20littletuxcreate
2006-12-19 14:27:54stefansetstatus: new
assignedto: (no value)
resolution: (no value)
messages: + msg588
nosy: + stefan
2007-05-02 16:01:42blindvtsetmessages: + msg662