don't put invalid UTF-8 data into wxString if Printf() fails in UTF-8 build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46475 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1566,6 +1566,11 @@ static int DoStringPrintfV(wxString& str,
|
|||||||
if ( !buf )
|
if ( !buf )
|
||||||
{
|
{
|
||||||
// out of memory
|
// out of memory
|
||||||
|
|
||||||
|
// in UTF-8 build, leaving uninitialized junk in the buffer
|
||||||
|
// could result in invalid non-empty UTF-8 string, so just
|
||||||
|
// reset the string to empty on failure:
|
||||||
|
buf[0] = '\0';
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1594,6 +1599,7 @@ static int DoStringPrintfV(wxString& str,
|
|||||||
// we know that our own implementation of wxVsnprintf() returns -1
|
// we know that our own implementation of wxVsnprintf() returns -1
|
||||||
// only for a format error - thus there's something wrong with
|
// only for a format error - thus there's something wrong with
|
||||||
// the user's format string
|
// the user's format string
|
||||||
|
buf[0] = '\0';
|
||||||
return -1;
|
return -1;
|
||||||
#else // possibly using system version
|
#else // possibly using system version
|
||||||
// assume it only returns error if there is not enough space, but
|
// assume it only returns error if there is not enough space, but
|
||||||
|
Reference in New Issue
Block a user