[Scummvm-git-logs] scummvm master -> 0b2c54ad070f83fbae1ae6b20478f6706044edec

bluegr noreply at scummvm.org
Wed May 10 21:23:49 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0b2c54ad07 ASYLUM: Fix use-after-free


Commit: 0b2c54ad070f83fbae1ae6b20478f6706044edec
    https://github.com/scummvm/scummvm/commit/0b2c54ad070f83fbae1ae6b20478f6706044edec
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-05-11T00:23:45+03:00

Commit Message:
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.

Changed paths:
    engines/asylum/system/text.cpp


diff --git a/engines/asylum/system/text.cpp b/engines/asylum/system/text.cpp
index 07a20fc1d43..6b2c476343e 100644
--- a/engines/asylum/system/text.cpp
+++ b/engines/asylum/system/text.cpp
@@ -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++;




More information about the Scummvm-git-logs mailing list