mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 16:29:55 +00:00
Fix unintended sign extension in compressed BSA hash generation
Which, however, never happens with non-ASCII characters
This commit is contained in:
parent
a8119f3863
commit
353b06325e
1 changed files with 5 additions and 1 deletions
|
@ -470,7 +470,11 @@ namespace Bsa
|
|||
return 0;
|
||||
std::replace(str.begin(), str.end(), '/', '\\');
|
||||
Misc::StringUtils::lowerCaseInPlace(str);
|
||||
uint64_t result = str[len - 1] | (len >= 3 ? (str[len - 2] << 8) : 0) | (len << 16) | (str[0] << 24);
|
||||
uint64_t result = str[len - 1];
|
||||
if (len >= 3)
|
||||
result |= str[len - 2] << 8;
|
||||
result |= len << 16;
|
||||
result |= static_cast<uint32_t>(str[0] << 24);
|
||||
if (len >= 4)
|
||||
{
|
||||
uint32_t hash = 0;
|
||||
|
|
Loading…
Reference in a new issue