Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when parse static buffer #7

Open
GoogleCodeExporter opened this issue May 18, 2015 · 1 comment
Open

Segmentation fault when parse static buffer #7

GoogleCodeExporter opened this issue May 18, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. write "static char gParseBuffer [MAX_SIZE];" in a file test.cpp
2. run rats -w3 --xml test.cpp 


What is the expected output? What do you see instead?
Expected to see the xml report of the Low warning: "fixed size global buffer". 
Got a segmentation fault just after <severity>Low</severity>

 $rats -w3 --xml test.cpp 
<?xml version="1.0"?><rats_output>
<stats>
<dbcount lang="perl">33</dbcount>
<dbcount lang="ruby">46</dbcount>
<dbcount lang="python">62</dbcount>
<dbcount lang="c">334</dbcount>
<dbcount lang="php">55</dbcount>
</stats>
<analyzed>test.cpp</analyzed>
<vulnerability>
  <severity>Low</severity>
Segmentation fault (core dumped)

What version of the product are you using? On what operating system?
RATS v2.3 on FreeBSD 10.0 amd64

If the report is exported to an xml file, this file end unexpectedly. This 
cause trouble to other tool exploiting this report.

Original issue reported on code.google.com by [email protected] on 23 Jan 2014 at 1:35

Attachments:

@GoogleCodeExporter
Copy link
Author

Tested with different syntax:
static char gParseBuffer [MAX_SIZE];
char gParseBuffer [MAX_SIZE];
char g [MAX_SIZE];
char g [1];
All segfault. But this work if circle by a function:
int main() { char g[1]; }
or just
{ char g[1]; }

Declaring a global array out of any block will cause rats to segfault.

Original comment by [email protected] on 23 Jan 2014 at 1:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant