[Scummvm-git-logs] scummvm master -> 4a10962c548ea11711b7c82771c84102a6cd9047

sev- noreply at scummvm.org
Thu May 29 13:29:11 UTC 2025


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

Summary:
4a10962c54 QDENGINE: Increased buffer for transCyrillic() and added guard against overflow


Commit: 4a10962c548ea11711b7c82771c84102a6cd9047
    https://github.com/scummvm/scummvm/commit/4a10962c548ea11711b7c82771c84102a6cd9047
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-05-29T15:29:04+02:00

Commit Message:
QDENGINE: Increased buffer for transCyrillic() and added guard against overflow

Changed paths:
    engines/qdengine/qdengine.cpp


diff --git a/engines/qdengine/qdengine.cpp b/engines/qdengine/qdengine.cpp
index a479af45757..e9263436adb 100644
--- a/engines/qdengine/qdengine.cpp
+++ b/engines/qdengine/qdengine.cpp
@@ -562,7 +562,7 @@ void scan_qda() {
 // Translates cp-1251..utf-8
 byte *transCyrillic(const Common::String &str) {
 	const byte *s = (const byte *)str.c_str();
-	static byte tmp[1024];
+	static byte tmp[10240];
 
 	static int trans[] = {
 		0xa0, 0xc2a0,
@@ -587,6 +587,9 @@ byte *transCyrillic(const Common::String &str) {
 	int i = 0;
 
 	for (const byte *p = s; *p; p++) {
+		if (i >= 10240 - 3)
+			break;
+
 		if (*p < 128) {
 			tmp[i++] = *p;
 		} else {
@@ -624,10 +627,10 @@ byte *transCyrillic(const Common::String &str) {
 		}
 	}
 
-	if (i < 1024)
+	if (i < 10240)
 		tmp[i] = 0;
 	else
-		tmp[1023] = 0;
+		tmp[10239] = 0;
 
 	return tmp;
 }




More information about the Scummvm-git-logs mailing list