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

Crash in editor search #300

Closed
singalen opened this issue Oct 5, 2017 · 6 comments
Closed

Crash in editor search #300

singalen opened this issue Oct 5, 2017 · 6 comments

Comments

@singalen
Copy link
Contributor

singalen commented Oct 5, 2017

Pressed F7 in an editor.
OS X 10.12, self-built wxWidgets.

* thread #11, stop reason = EXC_BAD_ACCESS (code=2, address=0x100effff0)
  * frame #0: 0x00007fffd32e61e4 libsystem_platform.dylib`_platform_memmove$VARIANT$Nehalem + 516
    frame #1: 0x00007fffd316b22d libsystem_c.dylib`wmemcpy + 18
    frame #2: 0x000000010026925d far2l`UnicodeString::Replace(this=0x000070000ad21f70, Pos=0, Len=0, Data=L"", DataLen=18446744073709551615) at UnicodeString.cpp:125
    frame #3: 0x000000010008ca3c far2l`UnicodeString::Copy(this=0x000070000ad21f70, Str=L"", StrLen=18446744073709551615) at UnicodeString.hpp:174
    frame #4: 0x000000010011d0e5 far2l`UnicodeString::UnicodeString(this=0x000070000ad21f70, lpwszData=L"", nLength=18446744073709551615) at UnicodeString.hpp:133
    frame #5: 0x0000000100119b95 far2l`UnicodeString::UnicodeString(this=0x000070000ad21f70, lpwszData=L"", nLength=18446744073709551615) at UnicodeString.hpp:133
    frame #6: 0x00000001001161ec far2l`Editor::Search(this=0x0000000100f89750, Next=0) at editor.cpp:3550
    frame #7: 0x00000001001100c0 far2l`Editor::ProcessKey(this=0x0000000100f89750, Key=65654) at editor.cpp:1989
    frame #8: 0x00000001001374a4 far2l`FileEditor::ReProcessKey(this=0x00000001010ea000, Key=65654, CalledFromControl=0) at fileedit.cpp:1327
    frame #9: 0x0000000100134aed far2l`FileEditor::ProcessKey(this=0x00000001010ea000, Key=65654) at fileedit.cpp:807
    frame #10: 0x00000001001ec81e far2l`Manager::ProcessKey(this=0x0000000101884200, Key=65654) at manager.cpp:1145
    frame #11: 0x00000001001eab47 far2l`Manager::ProcessMainLoop(this=0x0000000101884200) at manager.cpp:717
    frame #12: 0x00000001001ebd92 far2l`Manager::EnterMainLoop(this=0x0000000101884200) at manager.cpp:678
    frame #13: 0x00000001001e42b9 far2l`MainProcess(lpwszEditName=L"", lpwszViewName=L"", lpwszDestName1=L"", lpwszDestName2=L"", StartLine=-1, StartChar=-1) at main.cpp:285
    frame #14: 0x00000001001e36f3 far2l`MainProcessSEH(strEditName=0x000070000ad275d0, strViewName=0x000070000ad275c8, DestName1=0x000070000ad27d00, DestName2=0x000070000ad27d08, StartLine=-1, StartChar=-1) at main.cpp:302
    frame #15: 0x00000001001e615f far2l`FarAppMain(argc=1, argv=0x00007fff5fbff8c8) at main.cpp:586
    frame #16: 0x0000000100067e63 far2l`WinPortAppThread::Entry(this=0x0000000101834650) at Main.cpp:53
    frame #17: 0x0000000100376f2f far2l`wxThread::CallEntry() + 15
    frame #18: 0x0000000100376e00 far2l`wxThreadInternal::PthreadStart(wxThread*) + 1168
    frame #19: 0x00007fffd32f093b libsystem_pthread.dylib`_pthread_body + 180
    frame #20: 0x00007fffd32f0887 libsystem_pthread.dylib`_pthread_start + 286
    frame #21: 0x00007fffd32f008d libsystem_pthread.dylib`thread_start + 13
@elfmz
Copy link
Owner

elfmz commented Oct 5, 2017

is it reproducible on same file/search settings? If so - attach that if can.

@singalen
Copy link
Contributor Author

singalen commented Oct 5, 2017

It reproduced twice, but it doesn't now.
Here's the file anyway. Remove the .txt extension.
config.lua.txt

@singalen
Copy link
Contributor Author

singalen commented Oct 5, 2017

Another one, on an unpredictable moment.
crash2.txt

Looking at the source, I see that the cursor should be positioned specifically. Apparently CalcWordFromString is at fault.

BTW I thought search should pick up a selected block first, and only if the selection is empty, try to pick up a word?

@elfmz
Copy link
Owner

elfmz commented Oct 8, 2017

try following, in strmix.cpp:
replace if (IsWordDiv(strWordDiv,Str[EndWPos]))
with if (EndWPos > 0 && IsWordDiv(strWordDiv,Str[EndWPos]))

not sure if its fully correct, but there is definately potential problem and this should help

elfmz added a commit that referenced this issue Oct 8, 2017
@elfmz
Copy link
Owner

elfmz commented Oct 8, 2017

Refactored whole CalcWordFromString , plz check if crashes are gone and close bug if so

@singalen
Copy link
Contributor Author

Fixed. Thank you!

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

No branches or pull requests

2 participants