diff options
| -rw-r--r-- | meta/recipes-graphics/libsdl2/libsdl2/0001-Fix-potential-memory-leak-in-GLES_CreateTextur.patch | 40 | ||||
| -rw-r--r-- | meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb | 1 |
2 files changed, 41 insertions, 0 deletions
diff --git a/meta/recipes-graphics/libsdl2/libsdl2/0001-Fix-potential-memory-leak-in-GLES_CreateTextur.patch b/meta/recipes-graphics/libsdl2/libsdl2/0001-Fix-potential-memory-leak-in-GLES_CreateTextur.patch new file mode 100644 index 0000000000..31bda54dd3 --- /dev/null +++ b/meta/recipes-graphics/libsdl2/libsdl2/0001-Fix-potential-memory-leak-in-GLES_CreateTextur.patch | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | From 3cf2048b647484cc3a6abd0d78be60cead47b42d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Changqing Li <changqing.li@windriver.com> | ||
| 3 | Date: Fri, 24 Feb 2023 16:59:19 +0800 | ||
| 4 | Subject: [PATCH] Fix potential memory leak in GLES_CreateTextur | ||
| 5 | |||
| 6 | CVE: CVE-2022-4743 | ||
| 7 | Upstream-Status: Backport [https://github.com/libsdl-org/SDL/commit/00b67f55727bc0944c3266e2b875440da132ce4b] | ||
| 8 | |||
| 9 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
| 10 | --- | ||
| 11 | src/render/opengles/SDL_render_gles.c | 6 ++++++ | ||
| 12 | 1 file changed, 6 insertions(+) | ||
| 13 | |||
| 14 | diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c | ||
| 15 | index a6b58f2..237b1d6 100644 | ||
| 16 | --- a/src/render/opengles/SDL_render_gles.c | ||
| 17 | +++ b/src/render/opengles/SDL_render_gles.c | ||
| 18 | @@ -368,6 +368,9 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) | ||
| 19 | renderdata->glGenTextures(1, &data->texture); | ||
| 20 | result = renderdata->glGetError(); | ||
| 21 | if (result != GL_NO_ERROR) { | ||
| 22 | + if (texture->access == SDL_TEXTUREACCESS_STREAMING) { | ||
| 23 | + SDL_free(data->pixels); | ||
| 24 | + } | ||
| 25 | SDL_free(data); | ||
| 26 | return GLES_SetError("glGenTextures()", result); | ||
| 27 | } | ||
| 28 | @@ -396,6 +399,9 @@ GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) | ||
| 29 | |||
| 30 | result = renderdata->glGetError(); | ||
| 31 | if (result != GL_NO_ERROR) { | ||
| 32 | + if (texture->access == SDL_TEXTUREACCESS_STREAMING) { | ||
| 33 | + SDL_free(data->pixels); | ||
| 34 | + } | ||
| 35 | SDL_free(data); | ||
| 36 | return GLES_SetError("glTexImage2D()", result); | ||
| 37 | } | ||
| 38 | -- | ||
| 39 | 2.25.1 | ||
| 40 | |||
diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb index c1c827af79..abcf232e25 100644 --- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb +++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.20.bb | |||
| @@ -24,6 +24,7 @@ PROVIDES = "virtual/libsdl2" | |||
| 24 | SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \ | 24 | SRC_URI = "http://www.libsdl.org/release/SDL2-${PV}.tar.gz \ |
| 25 | file://optional-libunwind-generic.patch \ | 25 | file://optional-libunwind-generic.patch \ |
| 26 | file://0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch \ | 26 | file://0001-sdlchecks.cmake-pass-cflags-to-the-appropriate-cmake.patch \ |
| 27 | file://0001-Fix-potential-memory-leak-in-GLES_CreateTextur.patch \ | ||
| 27 | " | 28 | " |
| 28 | SRC_URI:append:class-native = " file://0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch" | 29 | SRC_URI:append:class-native = " file://0001-Disable-libunwind-in-native-OE-builds-by-not-looking.patch" |
| 29 | 30 | ||
