[Scummvm-git-logs] scummvm master -> a82501b638707b5742ab5cec7fb4174124e4175f

criezy noreply at scummvm.org
Mon Oct 3 17:43:04 UTC 2022


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:
a82501b638 AGS: Fix ReadEncInt32() on big-endian systems


Commit: a82501b638707b5742ab5cec7fb4174124e4175f
    https://github.com/scummvm/scummvm/commit/a82501b638707b5742ab5cec7fb4174124e4175f
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-10-03T18:42:58+01:00

Commit Message:
AGS: Fix ReadEncInt32() on big-endian systems

Fixes kq1agdi crashing on big-endian systems, since it tried to allocate
a gigantic amount of memory from MFLUtil::ReadV21() because of the
misread values.

>From upstream 5e29a339fc83bf5c06a3a9a3b1c65a2fc4b4e72c
Also includes upstream 427752da015fd93549deef1a31d5e533e5c9319e

Changed paths:
    engines/ags/shared/util/multi_file_lib.cpp


diff --git a/engines/ags/shared/util/multi_file_lib.cpp b/engines/ags/shared/util/multi_file_lib.cpp
index b4bc0f977f4..b4c0364ea95 100644
--- a/engines/ags/shared/util/multi_file_lib.cpp
+++ b/engines/ags/shared/util/multi_file_lib.cpp
@@ -402,9 +402,10 @@ int32_t MFLUtil::ReadEncInt32(Stream *in, int &rand_val) {
 	int val;
 	ReadEncArray(&val, sizeof(int32_t), 1, in, rand_val);
 #if AGS_PLATFORM_ENDIAN_BIG
-	AGS::Shared::BitByteOperations::SwapBytesInt32(val);
-#endif
+	return AGS::Shared::BitByteOperations::SwapBytesInt32(val);
+#else
 	return val;
+#endif
 }
 
 void MFLUtil::ReadEncString(char *buffer, size_t max_len, Stream *in, int &rand_val) {




More information about the Scummvm-git-logs mailing list