diff --git a/SDL2.spec b/SDL2.spec index 2356000e120eeb8cd6f9ce54ad24eefbdd366ccf..5aa8592730d8df8ab476c221fbc8baf33854f2f5 100644 --- a/SDL2.spec +++ b/SDL2.spec @@ -1,6 +1,6 @@ Name: SDL2 Version: 2.0.8 -Release: 10 +Release: 11 Summary: Cross-platform multimedia library License: zlib and MIT URL: http://www.libsdl.org/ @@ -9,6 +9,7 @@ Source1: SDL_config.h Patch0000: multilib.patch Patch0001: dynapi.patch Patch0002: CVE-2019-13616.patch +Patch6000: backport-CVE-2021-33657.patch BuildRequires: alsa-lib-devel audiofile-devel mesa-libGL-devel BuildRequires: mesa-libGLU-devel mesa-libEGL-devel libglvnd-devel BuildRequires: libXext-devel libX11-devel libXi-devel libXrandr-devel @@ -76,6 +77,12 @@ install -pm 0644 %{SOURCE1} %{buildroot}%{_includedir}/SDL2/SDL_config.h %{_datadir}/aclocal/* %changelog +* Tue Mar 15 2022 yuanxin - 2.0.8-11 +- Type:CVE +- ID:NA +- SUG:NA +- DESC:Fix CVE-2021-33657 + * Tue Oct 13 2020 hanhui - 2.0.8-10 - change mesa-libEGL-devel to libglvnd-devel in buildrequires diff --git a/backport-CVE-2021-33657.patch b/backport-CVE-2021-33657.patch new file mode 100644 index 0000000000000000000000000000000000000000..31c0c529c307e929afc5845c14399204adac1eec --- /dev/null +++ b/backport-CVE-2021-33657.patch @@ -0,0 +1,33 @@ +From 8c91cf7dba5193f5ce12d06db1336515851c9ee9 Mon Sep 17 00:00:00 2001 +From: Sam Lantinga +Date: Tue, 30 Nov 2021 12:36:46 -0800 +Subject: [PATCH] Always create a full 256-entry map in case color values are + out of range + +Fixes https://github.com/libsdl-org/SDL/issues/5042 +--- + src/video/SDL_pixels.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c +index ac04533c5d5..9bb02f771d0 100644 +--- a/src/video/SDL_pixels.c ++++ b/src/video/SDL_pixels.c +@@ -947,7 +947,7 @@ Map1to1(SDL_Palette * src, SDL_Palette * dst, int *identical) + } + *identical = 0; + } +- map = (Uint8 *) SDL_malloc(src->ncolors); ++ map = (Uint8 *) SDL_calloc(256, sizeof(Uint8)); + if (map == NULL) { + SDL_OutOfMemory(); + return (NULL); +@@ -971,7 +971,7 @@ Map1toN(SDL_PixelFormat * src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, Uint8 Amod, + SDL_Palette *pal = src->palette; + + bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel); +- map = (Uint8 *) SDL_malloc(pal->ncolors * bpp); ++ map = (Uint8 *) SDL_calloc(256, bpp); + if (map == NULL) { + SDL_OutOfMemory(); + return (NULL);