[Scummvm-git-logs] scummvm master -> 3e738f7734e54e3e1668332a4de0f683c5961ae8

sev- sev at scummvm.org
Mon Feb 24 08:18:42 UTC 2020


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:
3e738f7734 COMMON: Fix conversion to UTF32 for short strings


Commit: 3e738f7734e54e3e1668332a4de0f683c5961ae8
    https://github.com/scummvm/scummvm/commit/3e738f7734e54e3e1668332a4de0f683c5961ae8
Author: lolbot-iichan (lolbot_iichan at mail.ru)
Date: 2020-02-24T09:18:38+01:00

Commit Message:
COMMON: Fix conversion to UTF32 for short strings

Testcase: convert 1-byte encoded single character string from 125X to
UTF32, e.g. "=".

Expected result: got widestring, first dword contains "=", next dword
contains "\0"

Actual result: got widestring, first dword contains "=", second dword
contains garbage, next dword contains "\0"

Reference implementation:
http://www-personal.umich.edu/~bazald/l/api/_s_d_l__iconv_8c_source.html
, line 887

Changed paths:
    common/encoding.cpp


diff --git a/common/encoding.cpp b/common/encoding.cpp
index 34e173d..05a7deb 100644
--- a/common/encoding.cpp
+++ b/common/encoding.cpp
@@ -183,8 +183,8 @@ char *Encoding::convertIconv(const char *to, const char *from, const char *strin
 		return nullptr;
 
 	size_t inSize = length;
-	size_t outSize = inSize;
 	size_t stringSize = inSize > 4 ? inSize : 4;
+	size_t outSize = stringSize;
 
 
 #ifdef ICONV_USES_CONST




More information about the Scummvm-git-logs mailing list