ASYLUM: Fix use-after-free

String goes out of scope but its c_str is still used. Keep a reference while
we still need it.
This commit is contained in:
Vladimir Serbinenko 2023-05-10 02:27:49 +02:00 committed by Filippos Karapetis
parent bf669c6d44
commit 0b2c54ad07

View file

@ -190,8 +190,12 @@ void Text::draw(const char *text) {
return;
}
if (_vm->getLanguage() == Common::HE_ISR)
text = Common::convertBiDiString(text, Common::kWindows1255).c_str();
Common::String textRef;
if (_vm->getLanguage() == Common::HE_ISR) {
textRef = Common::convertBiDiString(text, Common::kWindows1255);
text = textRef.c_str();
}
while (*text) {
drawChar(text[0]);
text++;