PlistCpp
PlistCpp copied to clipboard
crash when string size is zero
very useful library.
i got a crash when one of the strings in a plist had empty string. to fix it had to change parseBinaryString to following:
inline std::string Plist::parseBinaryString(const PlistHelperData& d, int headerPosition)
{
unsigned char headerByte = d._objectTable[headerPosition];
int charStartPosition;
int32_t charCount = getCount(d, headerPosition, headerByte, charStartPosition);
charStartPosition += headerPosition;
std::string buffer;
if (charCount > 0)
{
std::vector<unsigned char> characterBytes = getRange(d._objectTable, charStartPosition, charCount);
buffer = std::string((char*) vecData(characterBytes), characterBytes.size());
}
return buffer;
}
Hi, sorry I can't replicate this issue. Not sure if it has been inadvertently fixed. I added an empty string test for both binary and xml and it passes. Do you have a plist to replicate?