check the validity of wxString pointer itself too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34896 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -404,15 +404,19 @@ wxDbgHelpDLL::DumpUDT(PSYMBOL_INFO pSym, void *pVariable, unsigned level)
|
|||||||
// between GetWriteBuf() and UngetWriteBuf() calls) and assert when we
|
// between GetWriteBuf() and UngetWriteBuf() calls) and assert when we
|
||||||
// try to access it contents using public methods, so instead use our
|
// try to access it contents using public methods, so instead use our
|
||||||
// knowledge of its internals
|
// knowledge of its internals
|
||||||
const wxChar *p = ps->data();
|
const wxChar *p = NULL;
|
||||||
wxStringData *data = (wxStringData *)p - 1;
|
if ( !::IsBadReadPtr(ps, sizeof(wxString)) )
|
||||||
if ( ::IsBadReadPtr(data, sizeof(wxStringData)) ||
|
|
||||||
::IsBadReadPtr(p, sizeof(wxChar *)*data->nAllocLength) )
|
|
||||||
{
|
{
|
||||||
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
|
else // any other UDT
|
||||||
#endif // !wxUSE_STL
|
#endif // !wxUSE_STL
|
||||||
|
Reference in New Issue
Block a user