Fixed a crash when a Stringref was an empty string (length 0)

Signed-off-by: Alexis Maiquez Murcia <almamu@almamu.com>
This commit is contained in:
Alexis Maiquez Murcia
2020-02-10 10:40:17 +01:00
parent 3d3719f844
commit 5437c3294f

View File

@@ -49,7 +49,9 @@ void PycString::load(PycData* stream, PycModule* mod)
if (type() == TYPE_STRINGREF) {
PycRef<PycString> str = mod->getIntern(stream->get32());
m_value.resize(str->length());
std::char_traits<char>::copy(&m_value.front(), str->value(), str->length());
if (str->length())
std::char_traits<char>::copy(&m_value.front(), str->value(), str->length());
} else {
int length;
if (type() == TYPE_SHORT_ASCII || type() == TYPE_SHORT_ASCII_INTERNED)