X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e1f2de5ab3df2ec6b5f4f10a8c62e80b524740b2..94972183b9ba592cee3a48e7052b3b16d8794dec:/src/msw/debughlp.cpp diff --git a/src/msw/debughlp.cpp b/src/msw/debughlp.cpp index cd8e486616..726900c638 100644 --- a/src/msw/debughlp.cpp +++ b/src/msw/debughlp.cpp @@ -25,7 +25,7 @@ #include "wx/msw/debughlp.h" -#if wxUSE_DBGHELP +#if wxUSE_DBGHELP && wxUSE_DYNLIB_CLASS // ---------------------------------------------------------------------------- // constants @@ -404,15 +404,19 @@ wxDbgHelpDLL::DumpUDT(PSYMBOL_INFO pSym, void *pVariable, unsigned level) // between GetWriteBuf() and UngetWriteBuf() calls) and assert when we // try to access it contents using public methods, so instead use our // knowledge of its internals - const wxChar *p = ps->data(); - wxStringData *data = (wxStringData *)p - 1; - if ( ::IsBadReadPtr(data, sizeof(wxStringData)) || - ::IsBadReadPtr(p, sizeof(wxChar *)*data->nAllocLength) ) + const wxChar *p = NULL; + if ( !::IsBadReadPtr(ps, sizeof(wxString)) ) { - p = _T("???"); + p = ps->data(); + wxStringData *data = (wxStringData *)p - 1; + if ( ::IsBadReadPtr(data, sizeof(wxStringData)) || + ::IsBadReadPtr(p, sizeof(wxChar *)*data->nAllocLength) ) + { + p = NULL; // don't touch this pointer with 10 feet pole + } } - s << _T("(\"") << p << _T(")\""); + s << _T("(\"") << (p ? p : _T("???")) << _T(")\""); } else // any other UDT #endif // !wxUSE_STL