News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Bug in 'source code formatter (AStyle)'

Started by mushakk, June 19, 2007, 12:35:11 PM

Previous topic - Next topic

mushakk

When I try to format generated code (gcc -E) sometimes the plugin crashes :(

Some of the lines in these files are up to 2840 chars!

Thx for your work!

dje

Hi !

I think your description is light...
Nightly ? OS? GCC version ? Bug report (*.RPT) ? File that made AStyle crash ?

It would be useful to debug. Don't forget to put the bug on BerliOS !

Dje

Ceniza

It would be great if you could provide a sample file that causes the plugin to crash.

mushakk

Sorry I'm using yesterday version (20 jun)

With this example file the app crashes.

QuoteDon't forget to put the bug on BerliOS
I'm new here. How can I do that? url for bugs?

[attachment deleted by admin]

MortenMacFly

Quote from: mushakk on June 20, 2007, 12:09:36 PM
With this example file the app crashes.
That's the culprit (asstreamiterator.h):

  wxChar buffer[2048];

It will result in crashing at line 47 in asstreamiterator.cpp:

  *filterPtr++ = *m_In;

(Notice that filterPtr equals buffer.)
So - you might want to just increase the value in the header to e.g. 4096 and that's basically it.

With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

Ceniza

Dynamic allocation seems to be a better choice :)

Fixed and committed :wink:

rickg22

Thanks, Cen! Yes, dynamic allocation is the way to go. Otherwise we'd be hitting buffer overflows everytime someone ends up with a weird file, and we'd do the resizing to 4096,8192, blah blah blah :-P

Thumbs up.

mushakk