tests: avoid undefined signed overflow

This commit is contained in:
Anonymous Maarten 2024-12-28 19:06:59 +01:00 committed by Anonymous Maarten
parent 156b3b4a8c
commit efba42a67b
4 changed files with 52 additions and 48 deletions

View file

@ -1073,7 +1073,7 @@ static int SDLCALL sdltest_randomIntegerInRange(void *arg)
#endif
/* Range with max at integer limit */
min = long_min - (Sint32)SDLTest_RandomSint16();
min = (Sint32)((Uint32)long_min + (Uint32)SDLTest_RandomSint16());
max = long_max;
result = SDLTest_RandomIntegerInRange(min, max);
SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)");