mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-11-03 17:24:34 +00:00 
			
		
		
		
	fix integer overflow ub in testautomation_sdltest
Patch originally from https://github.com/libsdl-org/sdl2-compat/pull/241
This commit is contained in:
		@@ -1074,13 +1074,13 @@ int sdltest_randomIntegerInRange(void *arg)
 | 
			
		||||
 | 
			
		||||
    /* Range with min at integer limit */
 | 
			
		||||
    min = long_min;
 | 
			
		||||
    max = long_max + (Sint32)SDLTest_RandomSint16();
 | 
			
		||||
    max = long_min + (Sint32)SDLTest_RandomUint16();
 | 
			
		||||
    result = SDLTest_RandomIntegerInRange(min, max);
 | 
			
		||||
    SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(SINT32_MIN,...)");
 | 
			
		||||
    SDLTest_AssertCheck(min <= result && result <= max, "Validated returned value; expected: [%" SDL_PRIs32 ",%" SDL_PRIs32 "], got: %" SDL_PRIs32, min, max, result);
 | 
			
		||||
 | 
			
		||||
    /* Range with max at integer limit */
 | 
			
		||||
    min = long_min - (Sint32)SDLTest_RandomSint16();
 | 
			
		||||
    min = long_max - (Sint32)SDLTest_RandomUint16();
 | 
			
		||||
    max = long_max;
 | 
			
		||||
    result = SDLTest_RandomIntegerInRange(min, max);
 | 
			
		||||
    SDLTest_AssertPass("Call to SDLTest_RandomIntegerInRange(...,SINT32_MAX)");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user