Page 1 of 1

Crash when opening single specific file

Posted: Mon Jul 08, 2013 2:45 pm
by evstevemd
I do not know why but I have this specific file (named Utils.cpp) when I try to open it (via compile errors tab or any other way) CL crashes!
Here is BT under GDB. All other files are fine. Strange enough is that I cannot find file in Project tree and trying to add it crashes CL

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0xb5a9a9e2 in std::string::assign(char const*, unsigned int) ()
   from /usr/lib/i386-linux-gnu/libstdc++.so.6
(gdb) bt
#0  0xb5a9a9e2 in std::string::assign(char const*, unsigned int) ()
   from /usr/lib/i386-linux-gnu/libstdc++.so.6
#1  0xb5a9ac26 in std::string::operator=(char const*) ()
   from /usr/lib/i386-linux-gnu/libstdc++.so.6
#2  0xb5f213bd in cl_scope_lex ()
    at /home/stefano/Documents/developer/git/codelite/CodeLite/cpp_lexer.cpp:1505
#3  0xb5f1aca0 in cl_var_parse ()
    at /home/stefano/Documents/developer/git/codelite/CodeLite/var_parser.cpp:1399
#4  0xb5f1728f in get_variables (in=..., li=..., ignoreMap=..., 
    isUsedWithinFunc=false)
    at /home/stefano/Documents/developer/git/codelite/CodeLite/var_parser.cpp:720
#5  0xb5f713df in TagsManager::GetVariables (this=0x8e3ee30, in=..., li=..., 
    ignoreMap=..., isUsedWithinFunc=false)
    at /home/stefano/Documents/developer/git/codelite/CodeLite/ctags_manager.cpp:2858
#6  0x0833f725 in ContextCpp::OnFileSaved (this=0xaa19228)
    at /home/stefano/Documents/developer/git/codelite/LiteEditor/context_cpp.cpp:1893
#7  0x0831902f in LEditor::UpdateColours (this=0xb8f9060)
    at /home/stefano/Documents/developer/git/codelite/LiteEditor/cl_editor.cpp:3---Type <return> to continue, or q <return> to quit---
157
#8  0x08314104 in LEditor::ReloadFile (this=0xb8f9060)
    at /home/stefano/Documents/developer/git/codelite/LiteEditor/cl_editor.cpp:2433
#9  0x08314336 in LEditor::Create (this=0xb8f9060, project=..., fileName=...)
    at /home/stefano/Documents/developer/git/codelite/LiteEditor/cl_editor.cpp:2468
#10 0x0834feba in MainBook::OpenFile (this=0x8ca3630, file_name=..., 
    projectName=..., lineno=47, position=-1, extra=OF_AddJump, 
    preserveSelection=true)
    at /home/stefano/Documents/developer/git/codelite/LiteEditor/mainbook.cpp:514
#11 0x08399039 in NewBuildTab::DoSelectAndOpen (this=0x8cf8518, item=...)
    at /home/stefano/Documents/developer/git/codelite/LiteEditor/new_build_tab.cpp:880
#12 0x0839790b in NewBuildTab::OnLineSelected (this=0x8cf8518, e=...)
    at /home/stefano/Documents/developer/git/codelite/LiteEditor/new_build_tab.cpp:629
#13 0xb6f99636 in wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#14 0xb6f999af in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#15 0xb70fc946 in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#16 0xb70fcd70 in wxEvtHandler::SearchDynamicEventTable(wxEvent&) ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#17 0xb70fce19 in wxEvtHandler::TryHereOnly(wxEvent&) ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#18 0xb70fceb4 in wxEvtHandler::ProcessEventLocally(wxEvent&) ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#19 0xb70fcf25 in wxEvtHandler::ProcessEvent(wxEvent&) ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#20 0xb70fcc6a in wxEvtHandler::SafelyProcessEvent(wxEvent&) ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#21 0xb74f9646 in wxWindowBase::HandleWindowEvent(wxEvent&) const ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_gtk2u_unofficial_core-2.9.so.4
#22 0xb77aa44e in ?? ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_gtk2u_unofficial_adv-2.9.so.4
#23 0xb7c8d311 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#24 0xb5264c36 in g_closure_invoke ()
   from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#25 0xb5276e13 in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#26 0xb527efa7 in g_signal_emit_valist ()
---Type <return> to continue, or q <return> to quit---
   from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#27 0xb527f233 in g_signal_emit ()
   from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#28 0xb7da1e1a in gtk_tree_view_row_activated ()
   from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#29 0xb7da7f72 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#30 0xb7c8b512 in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#31 0xb5263acd in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#32 0xb5264c36 in g_closure_invoke ()
   from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#33 0xb5276bfc in ?? () from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#34 0xb527ecc3 in g_signal_emit_valist ()
   from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#35 0xb527f233 in g_signal_emit ()
   from /usr/lib/i386-linux-gnu/libgobject-2.0.so.0
#36 0xb7dc3e7b in ?? () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#37 0xb7c89604 in gtk_propagate_event ()
   from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#38 0xb7c89c78 in gtk_main_do_event ()
   from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#39 0xb57a79e8 in ?? () from /usr/lib/i386-linux-gnu/libgdk-x11-2.0.so.0
#40 0xb519d3b3 in g_main_context_dispatch ()
   from /lib/i386-linux-gnu/libglib-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#41 0xb519d750 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#42 0xb519dc2b in g_main_loop_run () from /lib/i386-linux-gnu/libglib-2.0.so.0
#43 0xb7c88710 in gtk_main () from /usr/lib/i386-linux-gnu/libgtk-x11-2.0.so.0
#44 0xb736ab07 in wxGUIEventLoop::Run() ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_gtk2u_unofficial_core-2.9.so.4
#45 0xb6f9d18c in wxAppConsoleBase::MainLoop() ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#46 0xb6f994e2 in wxAppConsoleBase::OnRun() ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#47 0xb74176be in wxAppBase::OnRun() ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_gtk2u_unofficial_core-2.9.so.4
#48 0xb70225e2 in wxEntry(int&, wchar_t**) ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#49 0xb7022686 in wxEntry(int&, char**) ()
   from /usr/lib/i386-linux-gnu/codelite/libwx_baseu_unofficial-2.9.so.4
#50 0x08386894 in main (argc=1, argv=0xbffff224)
    at /home/stefano/Documents/developer/git/codelite/LiteEditor/app.cpp:218
(gdb) 

Re: Crash when opening single specific file

Posted: Mon Jul 08, 2013 2:58 pm
by evstevemd
Further checking show that the line that returns a string containing PHP Keywords causes a crash. Not sure which word exactly though :oops:

Re: Crash when opening single specific file

Posted: Mon Jul 08, 2013 2:58 pm
by eranif
Can you attach the source file?

Eran

Re: Crash when opening single specific file

Posted: Mon Jul 08, 2013 3:12 pm
by evstevemd
Here by attached is the function that causes crash.
Excuse the wrong names (I did wrong find/replace so just ignore as if you know nothing of *real correct* PHP keyword names ;))

Re: Crash when opening single specific file

Posted: Mon Jul 08, 2013 9:27 pm
by eranif
The Flex input buffer size is limited to 16KB (which is more than enough in 99.9% of the cases), in the sample file you provided you have a single token (the entire string is considered as a single token of type 'string')
Which causes memory corruption and crash.

I increased the generated flex code to use a 90KB max token size
It should be more than enough

Eran

Re: Crash when opening single specific file

Posted: Mon Jul 08, 2013 10:17 pm
by evstevemd
eranif wrote:The Flex input buffer size is limited to 16KB (which is more than enough in 99.9% of the cases), in the sample file you provided you have a single token (the entire string is considered as a single token of type 'string')
Which causes memory corruption and crash.

I increased the generated flex code to use a 90KB max token size
It should be more than enough

Eran
cool thanks!
Updating git