Skip to content

Commit 65885d5

Browse files
committed
Merge branch 'fix/native-code-warnings-comments' into release-3.3.0
fix: Correct warning generated by improper implicit type conversion.
2 parents 4b2ecbf + 8bc88f1 commit 65885d5

File tree

1 file changed

+9
-1
lines changed
  • lib/NativeCode/DynamicLibraryLoaderHelper/NativeRender

1 file changed

+9
-1
lines changed

lib/NativeCode/DynamicLibraryLoaderHelper/NativeRender/dllmain.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <codecvt>
4242
#include <vector>
4343
#include <iostream>
44+
#include <limits>
4445

4546

4647
//#include "eos_minimum_includes.h"
@@ -1375,11 +1376,18 @@ void eos_create(EOSConfig& eosConfig)
13751376
steamApiInterfaceVersionsAsCharArray.push_back('\0');
13761377

13771378
steam_platform.SteamApiInterfaceVersionsArray = reinterpret_cast<char*>(steamApiInterfaceVersionsAsCharArray.data());
1379+
1380+
auto size = steamApiInterfaceVersionsAsCharArray.size();
1381+
1382+
if (size > (std::numeric_limits<uint32_t>::max)()) {
1383+
log_error("Size given for SteamApiInterfaceVersionsAsCharArray exceeds the maximum value for uint32_t.");
1384+
throw std::overflow_error("Size exceeds the maximum value for uint32_t");
1385+
}
13781386

13791387
// steam_platform needs to have a count of how many bytes the "array" is, stored in SteamApiInterfaceVersionsArrayBytes
13801388
// This has some fuzzy behavior; if you set it to 0 or count it up properly, there won't be a logged problem
13811389
// if you put a non-zero amount that is insufficient, there will be an unclear logged error message
1382-
steam_platform.SteamApiInterfaceVersionsArrayBytes = steamApiInterfaceVersionsAsCharArray.size();
1390+
steam_platform.SteamApiInterfaceVersionsArrayBytes = static_cast<uint32_t>(size);
13831391

13841392
steam_integrated_platform_option.ApiVersion = EOS_INTEGRATEDPLATFORM_OPTIONS_API_LATEST;
13851393
steam_integrated_platform_option.Type = EOS_IPT_Steam;

0 commit comments

Comments
 (0)