SDL/src
Simon McVittie fd495bb57c SDLTest_CompareSurfaces: Decode pixels correctly on big-endian platforms
Previously, if acting on a surface with less than 32 bits per pixel,
this code was placing the pixel value from the surface in the first
few bytes of the Uint32 to be decoded, and unrelated data from a
subsequent pixel in the remaining bytes.

Because SDL_GetRGBA takes the bits to be decoded from the
least-significant bits of the given value, ignoring the higher-order
bits if any, this happened to be correct on little-endian platforms,
where the first few bytes store the least-significant bits of an
integer.

However, it was incorrect on big-endian, where the first few bytes are
the most-significant bits of an integer.

The previous implementation also assumed that unaligned access to a
32-bit quantity is possible, which is not the case on all CPUs (but
happens to be true on x86).

These issues were not discovered until now because
SDLTest_CompareSurfaces() is only used in testautomation, which until
recently was not being run routinely at build-time, because it contained
other assumptions that can fail in an autobuilder or CI environment.

Resolves: https://github.com/libsdl-org/SDL/issues/8315
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit d95d2d7051)
(cherry picked from commit 6b5eadb10f)
2023-09-29 06:57:07 -07:00
..
atomic Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
audio emscripten: Add JS library dependencies using EM_JS_DEPS macro 2023-09-15 15:29:47 -07:00
core Remove the unimplemented CloseIC in fcitx module 2023-07-20 13:37:31 -07:00
cpuinfo Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
dynapi SDL_dynapi.c: minor cosmetics. 2023-06-10 20:50:10 +03:00
events Fixed duplicate key press/release events on iOS 2023-08-02 01:29:30 -07:00
file SDL_RWFromMem, SDL_RWFromConstMem: reject negative size parameters. 2023-07-10 00:15:56 +03:00
filesystem Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
haptic Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
hidapi Quiet spurious warning 2023-08-13 13:54:45 -07:00
joystick Check for NULL before dereferencing newly allocated memory 2023-09-24 17:19:03 -07:00
libm Updated copyright for 2023 2023-01-09 09:48:21 -08:00
loadso Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
locale Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
main Updated to version 2.28.3 for release 2023-09-01 11:22:07 -07:00
misc emscripten: Add JS library dependencies using EM_JS_DEPS macro 2023-09-15 15:29:47 -07:00
power Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
render render: Enable clipping for zero-sized rectangles 2023-09-09 11:14:25 -07:00
sensor Code style: changed "sizeof foo" to "sizeof(foo)" (thanks @sezero!) 2023-03-09 15:23:59 -08:00
stdlib SDL_iconv_string() defaults to UTF-8 2023-09-24 17:28:23 -07:00
test SDLTest_CompareSurfaces: Decode pixels correctly on big-endian platforms 2023-09-29 06:57:07 -07:00
thread Unaligned stacks on i686-w64-mingw32, may lead to crashes (#7607) 2023-07-10 03:10:20 +03:00
timer Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
video emscripten: Restore compatibility with existing emsdk releases. 2023-09-20 14:37:56 -04:00
SDL.c Unaligned stacks on i686-w64-mingw32, may lead to crashes (#7607) 2023-07-10 03:10:20 +03:00
SDL_assert.c emscripten: Restore compatibility with existing emsdk releases. 2023-09-20 14:37:56 -04:00
SDL_assert_c.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_dataqueue.c Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
SDL_dataqueue.h dataqueue: Make thread safe. 2023-03-02 16:43:44 -05:00
SDL_error.c Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
SDL_error_c.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_guid.c Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_hints.c Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
SDL_hints_c.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_internal.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_list.c Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_list.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_log.c Updated source to match SDL function prototype style 2023-05-23 10:59:03 -07:00
SDL_log_c.h Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_utils.c Updated copyright for 2023 2023-01-09 09:48:21 -08:00
SDL_utils_c.h Don't bother re-encoding Latin1 characters in the ASCII range 2023-06-04 05:40:07 -07:00