Apparently CFStringGetBytes() doesn't always behave as expected, work around
this by checking that the returned buffer size is not greater than the size we
passed in.
Closes #11859.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63772
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
m_encoding,
0, // FAIL on unconvertible characters
false, // not an external representation
m_encoding,
0, // FAIL on unconvertible characters
false, // not an external representation
- // if dstSize is 0 then pass NULL to get required length in usedBufLen
- (dstSize != 0)?(UInt8*)dst:NULL,
- if(charsConverted < CFStringGetLength(theString) )
+ // when dst is non-NULL, we check usedBufLen against dstSize as
+ // CFStringGetBytes sometimes treats dst as being NULL when dstSize==0
+ if( (charsConverted < CFStringGetLength(theString)) ||
+ (dst && (size_t) usedBufLen > dstSize) )
return wxCONV_FAILED;
return usedBufLen;
return wxCONV_FAILED;
return usedBufLen;