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
This commit is contained in:
parent
7e3d996e47
commit
3691fdd57d
1 changed files with 3 additions and 2 deletions
|
@ -402,9 +402,10 @@ int32_t MFLUtil::ReadEncInt32(Stream *in, int &rand_val) {
|
||||||
int val;
|
int val;
|
||||||
ReadEncArray(&val, sizeof(int32_t), 1, in, rand_val);
|
ReadEncArray(&val, sizeof(int32_t), 1, in, rand_val);
|
||||||
#if AGS_PLATFORM_ENDIAN_BIG
|
#if AGS_PLATFORM_ENDIAN_BIG
|
||||||
AGS::Shared::BitByteOperations::SwapBytesInt32(val);
|
return AGS::Shared::BitByteOperations::SwapBytesInt32(val);
|
||||||
#endif
|
#else
|
||||||
return val;
|
return val;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MFLUtil::ReadEncString(char *buffer, size_t max_len, Stream *in, int &rand_val) {
|
void MFLUtil::ReadEncString(char *buffer, size_t max_len, Stream *in, int &rand_val) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue