Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
8fb858ef83
!43 [sync] PR-42: add loongarch64 and sw_64 support
From: @openeuler-sync-bot 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2023-04-24 06:42:43 +00:00
panchenbo
2000caed60 add loongarch64 and sw_64 support
(cherry picked from commit baa2678aef208977ce1a4360ed678fb2c7dc608c)
2023-04-24 13:42:17 +08:00
openeuler-ci-bot
0c90ba36c6
!38 [sync] PR-34: Fix CVE-2022-4743
From: @openeuler-sync-bot 
Reviewed-by: @gitee-cmd 
Signed-off-by: @gitee-cmd
2023-01-10 09:44:01 +00:00
peng2285
b9b49727df fix CVE-2022-4743
modified:   SDL2.spec

(cherry picked from commit 6edb5a5e86cb2b5f9835db0ca7615eaef2f5101c)
2023-01-10 17:18:42 +08:00
openeuler-ci-bot
bdd7e40a2b
!23 [sync] PR-19: Fix CVE-2020-14409 CVE-2020-14410
From: @openeuler-sync-bot 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2022-04-12 12:09:56 +00:00
starlet-dx
3ea269a973 Fix CVE-2020-14409 CVE-2020-14410
(cherry picked from commit 98554f7772187d9153060341a9d8c2fb1be93147)
2022-04-12 19:14:57 +08:00
openeuler-ci-bot
bc13d15a8b
!16 [sync] PR-13: Fix CVE-2021-33657
From: @openeuler-sync-bot 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2022-03-17 02:47:05 +00:00
xinyingchao
4a070cc46d Fix CVE-2021-33657
(cherry picked from commit d8f524d4a650dff8b9ea6cc084973d39795d99cc)
2022-03-16 17:17:59 +08:00
openeuler-ci-bot
a37fb323bf
!10 Fix build against wayland
Merge pull request !10 from zhouwenpei/openEuler-22.03-LTS-Next
2022-01-10 12:10:28 +00:00
zhouwenpei
3e2403ef3d Fix build against wayland 2022-01-08 20:08:23 +08:00
6 changed files with 217 additions and 1 deletions

View File

@ -0,0 +1,73 @@
From a7ff6e96155f550a5597621ebeddd03c98aa9294 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <slouken@libsdl.org>
Date: Wed, 17 Jun 2020 08:44:45 -0700
Subject: [PATCH] Fixed overflow in surface pitch calculation
---
src/video/SDL_surface.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c
index 085d9ff1e17..bff826f7cc6 100644
--- a/src/video/SDL_surface.c
+++ b/src/video/SDL_surface.c
@@ -28,24 +28,23 @@
#include "SDL_yuv_c.h"
-/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */
-SDL_COMPILE_TIME_ASSERT(surface_size_assumptions,
- sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32));
+/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow Sint64 */
+SDL_COMPILE_TIME_ASSERT(surface_size_assumptions, sizeof(int) == sizeof(Sint32));
/* Public routines */
/*
* Calculate the pad-aligned scanline width of a surface
*/
-static int
+static Sint64
SDL_CalculatePitch(Uint32 format, int width)
{
- int pitch;
+ Sint64 pitch;
if (SDL_ISPIXELFORMAT_FOURCC(format) || SDL_BITSPERPIXEL(format) >= 8) {
- pitch = (width * SDL_BYTESPERPIXEL(format));
+ pitch = ((Sint64)width * SDL_BYTESPERPIXEL(format));
} else {
- pitch = ((width * SDL_BITSPERPIXEL(format)) + 7) / 8;
+ pitch = (((Sint64)width * SDL_BITSPERPIXEL(format)) + 7) / 8;
}
pitch = (pitch + 3) & ~3; /* 4-byte aligning for speed */
return pitch;
@@ -59,11 +58,19 @@ SDL_Surface *
SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth,
Uint32 format)
{
+ Sint64 pitch;
SDL_Surface *surface;
/* The flags are no longer used, make the compiler happy */
(void)flags;
+ pitch = SDL_CalculatePitch(format, width);
+ if (pitch < 0 || pitch > SDL_MAX_SINT32) {
+ /* Overflow... */
+ SDL_OutOfMemory();
+ return NULL;
+ }
+
/* Allocate the surface */
surface = (SDL_Surface *) SDL_calloc(1, sizeof(*surface));
if (surface == NULL) {
@@ -78,7 +85,7 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth,
}
surface->w = width;
surface->h = height;
- surface->pitch = SDL_CalculatePitch(format, width);
+ surface->pitch = (int)pitch;
SDL_SetClipRect(surface, NULL);
if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {

33
CVE-2022-4743.patch Normal file
View File

@ -0,0 +1,33 @@
From 00b67f55727bc0944c3266e2b875440da132ce4b Mon Sep 17 00:00:00 2001
From: zhailiangliang <zhailiangliang@loongson.cn>
Date: Wed, 21 Sep 2022 10:30:38 +0800
Subject: [PATCH] Fix potential memory leak in GLES_CreateTexture
---
src/render/opengles/SDL_render_gles.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index a5fbab309eda..ba08a46e2805 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -359,6 +359,9 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
renderdata->glGenTextures(1, &data->texture);
result = renderdata->glGetError();
if (result != GL_NO_ERROR) {
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ SDL_free(data->pixels);
+ }
SDL_free(data);
return GLES_SetError("glGenTextures()", result);
}
@@ -387,6 +390,9 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
result = renderdata->glGetError();
if (result != GL_NO_ERROR) {
+ if (texture->access == SDL_TEXTUREACCESS_STREAMING) {
+ SDL_free(data->pixels);
+ }
SDL_free(data);
return GLES_SetError("glTexImage2D()", result);
}

View File

@ -0,0 +1,42 @@
From 068c13b1cac4fead98a458b70ef482ddc8205358 Mon Sep 17 00:00:00 2001
From: David Redondo <kde@david-redondo.de>
Date: Fri, 10 Dec 2021 16:22:34 +0100
Subject: [PATCH] Fix build against wayland 1.20
Fixes #5088
---
src/video/wayland/SDL_waylanddyn.h | 2 ++
src/video/wayland/SDL_waylandsym.h | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index 485a9c1..8ab0505 100644
--- a/src/video/wayland/SDL_waylanddyn.h
+++ b/src/video/wayland/SDL_waylanddyn.h
@@ -78,6 +78,8 @@ void SDL_WAYLAND_UnloadSymbols(void);
#define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data)
#define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data)
#define wl_proxy_get_version (*WAYLAND_wl_proxy_get_version)
+#define wl_proxy_marshal_flags (*WAYLAND_wl_proxy_marshal_flags)
+#define wl_proxy_marshal_array_flags (*WAYLAND_wl_proxy_marshal_array_flags)
#define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener)
#define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor)
#define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned)
diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h
index c4c189d..789f49e 100644
--- a/src/video/wayland/SDL_waylandsym.h
+++ b/src/video/wayland/SDL_waylandsym.h
@@ -71,6 +71,10 @@ SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_prox
SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_10)
SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor_versioned, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...))
+SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_20)
+SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interfac, uint32_t version, uint32_t flags, ...))
+SDL_WAYLAND_SYM(struct wl_proxy*, wl_proxy_marshal_array_flags, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, uint32_t flags, union wl_argument *args))
+
SDL_WAYLAND_INTERFACE(wl_seat_interface)
SDL_WAYLAND_INTERFACE(wl_surface_interface)
SDL_WAYLAND_INTERFACE(wl_shm_pool_interface)
--
1.8.3.1

View File

@ -1,6 +1,6 @@
Name: SDL2
Version: 2.0.12
Release: 1
Release: 7
Summary: Cross-platform multimedia library
License: zlib and MIT
URL: http://www.libsdl.org/
@ -8,13 +8,22 @@ Source0: http://www.libsdl.org/release/%{name}-%{version}.tar.gz
Source1: SDL_config.h
Patch0000: multilib.patch
Patch0001: SDL2-2.0.9-khrplatform.patch
Patch0002: Fix-build-against-wayland-1.20.patch
#https://github.com/libsdl-org/SDL/commit/a7ff6e96155f550a5597621ebeddd03c98aa9294
Patch0003: CVE-2020-14409_CVE-2020-14410.patch
Patch6000: backport-CVE-2021-33657.patch
Patch6001: CVE-2022-4743.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
BuildRequires: libXrender-devel libXScrnSaver-devel libusb-devel
BuildRequires: libXinerama-devel libXcursor-devel systemd-devel
%ifarch loongarch64
BuildRequires: pkgconfig(libpulse-simple)
%else
BuildRequires: pkgconfig(libpulse-simple) pkgconfig(jack)
%endif
BuildRequires: pkgconfig(dbus-1) pkgconfig(ibus-1.0)
BuildRequires: pkgconfig(wayland-client) pkgconfig(wayland-egl)
BuildRequires: pkgconfig(wayland-cursor) pkgconfig(wayland-protocols)
@ -89,6 +98,27 @@ rm -vf %{buildroot}%{_libdir}/*.la
%{_libdir}/lib*.a
%changelog
* Mon Apr 24 2023 panchenbo <panchenbo@kylinsec.com.cn> - 2.0.12-7
- add sw_64 support
* Thu Mar 02 2023 Wenlong Zhang<zhangwenlong@loongson.cn> - 2.0.12-6
- add loongarch support
* Tue Jan 10 2023 jiangpeng <jiangpeng01@ncti-gba.cn> - 2.0.12-5
- fix CVE-2022-4743
* Mon Apr 11 2022 yaoxin <yaoxin30@h-partners.com> - 2.0.12-4
- Fix CVE-2020-14409 CVE-2020-14410
* Tue Mar 15 2022 yuanxin <yuanxin24@h-partners.com> - 2.0.12-3
- Type:CVE
- ID:NA
- SUG:NA
- DESC:Fix CVE-2021-33657
* Sat Jan 8 2022 zhouwenpei <zhouwenpei1@huawei.com> - 2.0.12-2
- Fix build against wayland
* Mon Nov 16 2020 Zhiyi Weng <zhiyi@iscas.ac.cn> - 2.0.12-1
- Update to 2.0.12

View File

@ -60,6 +60,8 @@
#include "SDL_config-arm.h"
#elif defined(__alpha__)
#include "SDL_config-alpha.h"
#elif defined(__sw_64__)
#include "SDL_config-sw_64.h"
#elif defined(__sparc__) && defined (__arch64__)
#include "SDL_config-sparc64.h"
#elif defined(__sparc__)
@ -76,6 +78,9 @@
#include "SDL_config-mips.h"
#elif defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
#include "SDL_config-riscv64.h"
#elif defined(__loongarch64)
#include "SDL_config-loongarch64.h"
#else
#error "The SDL2-devel package is not usable with the architecture."
#endif

View File

@ -0,0 +1,33 @@
From 8c91cf7dba5193f5ce12d06db1336515851c9ee9 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <slouken@libsdl.org>
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);