openMSX / wxcatapult

23 stars 4 forks source link

[Bug] wxCatapult: msvc win64 fonts crash [sf#489] #22

Closed openMSX-import closed 9 years ago

openMSX-import commented 9 years ago

Reported by vampier on 2013-08-01 05:59 UTC when openMSX send an error message to catapult it's supposed to show up in the 'Status Info' log window. In the 64bit version it crashed openMSX.

here is the trace:

    catapult.exe!wxFontEnumeratorHelper::OnFont(tagLOGFONTW * const lf, tagTEXTMETRICW * const tm) Line 182 C++
    catapult.exe!wxFontEnumeratorProc(tagLOGFONTW * lplf, tagTEXTMETRICW * lptm, unsigned long __formal, long lParam) Line 288  C++
    gdi32.dll!000007fa7ce842e7()    Unknown
    gdi32.dll!000007fa7ce84386()    Unknown
    catapult.exe!wxFontEnumeratorHelper::DoEnumerate() Line 175 C++
    catapult.exe!wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, bool fixedWidthOnly) Line 250    C++
    catapult.exe!wxFontEnumerator::GetFacenames(wxFontEncoding encoding, bool fixedWidthOnly) Line 65   C++
    catapult.exe!wxFontEnumerator::IsValidFacename(const wxString & facename) Line 81   C++
    catapult.exe!wxNativeFontInfo::SetFaceName(const wxArrayString & facenames) Line 414    C++
    catapult.exe!wxNativeFontInfo::SetFamily(wxFontFamily family) Line 668  C++
    catapult.exe!wxNativeFontInfo::InitFromFont(const wxFont & font) Line 171   C++
    catapult.exe!wxFillLogFont(tagLOGFONTW * logFont, const wxFont * font) Line 279 C++
    catapult.exe!wxFont::RealizeResource() Line 877 C++
    catapult.exe!wxFont::DoCreate(int pointSize, const wxSize & pixelSize, bool sizeUsingPixels, int family, int style, int weight, bool underlined, const wxString & faceName, wxFontEncoding encoding) Line 857   C++
>   catapult.exe!openMSXController::HandleParsedOutput(wxCommandEvent & event) Line 246 C++
    catapult.exe!openMSXWindowsController::HandleMessage(wxCommandEvent & event) Line 46    C++
    catapult.exe!wxEvtHandler::ProcessEventIfMatches(const wxEventTableEntryBase & entry, wxEvtHandler * handler, wxEvent & event) Line 1241    C++
    catapult.exe!wxEventHashTable::HandleEvent(wxEvent & event, wxEvtHandler * self) Line 907   C++
    catapult.exe!wxEvtHandler::ProcessEvent(wxEvent & event) Line 1301  C++
    catapult.exe!wxEvtHandler::ProcessPendingEvents() Line 1196 C++
    catapult.exe!wxAppConsole::ProcessPendingEvents() Line 296  C++
    catapult.exe!wxIdleWakeUpModule::MsgHookProc(int nCode, unsigned __int64 wParam, __int64 lParam) Line 6841  C++
    user32.dll!000007fa7db919ec()   Unknown
    user32.dll!000007fa7db917b5()   Unknown
    user32.dll!000007fa7db91826()   Unknown
    ntdll.dll!000007fa7de34b67()    Unknown
    user32.dll!000007fa7db91eba()   Unknown
    user32.dll!000007fa7db91ef5()   Unknown
    catapult.exe!wxEventLoop::Dispatch() Line 227   C++
    catapult.exe!wxEventLoopManual::Run() Line 115  C++
    catapult.exe!wxAppBase::MainLoop() Line 312 C++
    catapult.exe!wxEntryReal(int & argc, wchar_t * * argv) Line 448 C++
    catapult.exe!wxEntry(int & argc, wchar_t * * argv) Line 209 C++
    catapult.exe!wxEntry(HINSTANCE__ * hInstance, HINSTANCE__ * __formal, char * __formal, int nCmdShow) Line 386   C++
    catapult.exe!__tmainCRTStartup() Line 238   C
    kernel32.dll!000007fa7cfc1832() Unknown
    ntdll.dll!000007fa7de8d609()    Unknown
openMSX-import commented 9 years ago

Updated by joxy on 2013-08-01 06:01 UTC

openMSX-import commented 9 years ago

Commented by manuelbi on 2013-08-05 21:03 UTC There are some compilation optiosn for wxWidgets, some include fonts (FontMapper stuff). Perhaps that's related?

openMSX-import commented 9 years ago

Commented by vampier on 2013-08-18 18:13 UTC https://www.google.com/search?q=wxNativeFontInfo+windows8

openMSX-import commented 9 years ago

Commented by manuelbi on 2013-08-18 18:49 UTC Could be this issue: http://trac.wxwidgets.org/ticket/15148

openMSX-import commented 9 years ago

Commented by manuelbi on 2013-08-18 18:55 UTC Does it help to compile wxWidgets with

// wxFontMapper class
#define wxUSE_FONTMAP 0

in wxMSW-2.8.9/include/wx/msw/setup.h?

openMSX-import commented 9 years ago

Commented by vampier on 2013-08-18 23:21 UTC ....\derived\3rdparty\src\wxMSW-2.8.12\src\xrc\xmlres.cpp(1436): error C2065: 'wxFontMapper' : undeclared identifier ....\derived\3rdparty\src\wxMSW-2.8.12\src\xrc\xmlres.cpp(1436): error C2146: syntax error : missing ';' before identifier 'mapper' ....\derived\3rdparty\src\wxMSW-2.8.12\src\xrc\xmlres.cpp(1436): error C2065: 'mapper' : undeclared identifier ....\derived\3rdparty\src\wxMSW-2.8.12\src\xrc\xmlres.cpp(1438): error C2065: 'mapper' : undeclared identifier ....\derived\3rdparty\src\wxMSW-2.8.12\src\xrc\xmlres.cpp(1438): error C2228: left of '.CharsetToEncoding' must have class/struct/union

On Sun, Aug 18, 2013 at 11:55 AM, Manuel Bilderbeek manuelbi@users.sf.netwrote:

Does it help to compile wxWidgets with

// wxFontMapper class#define wxUSE_FONTMAP 0

in wxMSW-2.8.9/include/wx/msw/setup.h?

Status: open Labels: wxCatapult Created: Thu Aug 01, 2013 05:59 AM UTC by Patrick van Arkel Last Updated: Sun Aug 18, 2013 06:49 PM UTC Owner: joxy

when openMSX send an error message to catapult it's supposed to show up in the 'Status Info' log window. In the 64bit version it crashed openMSX.

here is the trace: catapult.exe!wxFontEnumeratorHelper::OnFont(tagLOGFONTW * const lf, tagTEXTMETRICW * const tm) Line 182 C++ catapult.exe!wxFontEnumeratorProc(tagLOGFONTW * lplf, tagTEXTMETRICW lptm, unsigned long formal, long lParam) Line 288 C++ gdi32.dll!000007fa7ce842e7() Unknown gdi32.dll!000007fa7ce84386() Unknown catapult.exe!wxFontEnumeratorHelper::DoEnumerate() Line 175 C++ catapult.exe!wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding, bool fixedWidthOnly) Line 250 C++ catapult.exe!wxFontEnumerator::GetFacenames(wxFontEncoding encoding, bool fixedWidthOnly) Line 65 C++ catapult.exe!wxFontEnumerator::IsValidFacename(const wxString & facename) Line 81 C++ catapult.exe!wxNativeFontInfo::SetFaceName(const wxArrayString & facenames) Line 414 C++ catapult.exe!wxNativeFontInfo::SetFamily(wxFontFamily family) Line 668 C++ catapult.exe!wxNativeFontInfo::InitFromFont(const wxFont & font) Line 171 C++ catapult.exe!wxFillLogFont(tagLOGFONTW * logFont, const wxFont * font) Line 279 C++ catapult.exe!wxFont::RealizeResource() Line 877 C++ catapult.exe!wxFont::DoCreate(int pointSize, const wxSize & pixelSize, bool sizeUsingPixels, int family, int style, int weight, bool underlined, const wxString & faceName, wxFontEncoding encoding) Line 857 C++

catapult.exe!openMSXController::HandleParsedOutput(wxCommandEvent & event) Line 246 C++ catapult.exe!openMSXWindowsController::HandleMessage(wxCommandEvent & event) Line 46 C++ catapult.exe!wxEvtHandler::ProcessEventIfMatches(const wxEventTableEntryBase & entry, wxEvtHandler * handler, wxEvent & event) Line 1241 C++ catapult.exe!wxEventHashTable::HandleEvent(wxEvent & event, wxEvtHandler self) Line 907 C++ catapult.exe!wxEvtHandler::ProcessEvent(wxEvent & event) Line 1301 C++ catapult.exe!wxEvtHandler::ProcessPendingEvents() Line 1196 C++ catapult.exe!wxAppConsole::ProcessPendingEvents() Line 296 C++ catapult.exe!wxIdleWakeUpModule::MsgHookProc(int nCode, unsigned _int64 wParam, int64 lParam) Line 6841 C++ user32.dll!000007fa7db919ec() Unknown user32.dll!000007fa7db917b5() Unknown user32.dll!000007fa7db91826() Unknown ntdll.dll!000007fa7de34b67() Unknown user32.dll!000007fa7db91eba() Unknown user32.dll!000007fa7db91ef5() Unknown catapult.exe!wxEventLoop::Dispatch() Line 227 C++ catapult.exe!wxEventLoopManual::Run() Line 115 C++ catapult.exe!wxAppBase::MainLoop() Line 312 C++ catapult.exe!wxEntryReal(int & argc, wchar_t * argv) Line 448 C++ catapult.exe!wxEntry(int & argc, wchart * argv) Line 209 C++ catapult.exe!wxEntry(HINSTANCE * hInstance, HINSTANCE* * _formal, char formal, int nCmdShow) Line 386 C++ catapult.exe!_tmainCRTStartup() Line 238 C kernel32.dll!000007fa7cfc1832() Unknown ntdll.dll!000007fa7de8d609() Unknown


Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/openmsx/bugs/489/

To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

openMSX-import commented 9 years ago

Updated by manuelbi on 2013-11-14 19:54 UTC

openMSX-import commented 9 years ago

Commented by manuelbi on 2013-11-14 19:54 UTC Max wrote: The bug is in wxwidgets:

    int CALLBACK wxFontEnumeratorProc(LPLOGFONT lplf, LPTEXTMETRIC lptm,
                                                DWORD dwStyle, LONG lParam);

That LONG should be an LPARAM. LONG is 32-bit. So any pointers passed through here will be truncated.

Note the bogus value in rcx, aka this. Before going through the callback, rcx was 000000e8aaaceb70

0:000> r rax=000000e8af0571bc rbx=000000e8af0571b0 rcx=ffffffffaaaceb70 rdx=000000e8af0571bc rsi=000000e8af0571bc rdi=ffffffffaaaceb70 rip=00007ff7cfe718dc rsp=000000e8aaace940 rbp=0000000000000001 r8=000000e8af057328 r9=000000e8aaaceb70 r10=0000000000000000 r11=0000000000000246 r12=0000000000000001 r13=0000000000000000 r14=0000000000000000 r15=000000e8aaacf1e8 iopl=0 nv up ei pl nz na pe nc cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010202 catapult!wxFontEnumeratorHelper::OnFont+0x1c: 00007ff7cfe718dc 80792100 cmp byte ptr [rcx+21h],0 ds:ffffffffaaaceb91=??

Patrick tried that and indeed, this fixes the issue! Yay.

Thanks Max, for the analysis.