SDL2: patch GetModeList potential bogus free (#13590)

This commit is contained in:
erysdren
2026-01-08 11:20:53 -06:00
committed by GitHub
parent 4318f26513
commit 048fa7976c
2 changed files with 50 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ software, emulators, and popular games."
HOMEPAGE="https://www.libsdl.org/"
COPYRIGHT="1997-2025 Sam Lantinga"
LICENSE="Zlib"
REVISION="1"
REVISION="2"
SOURCE_URI="https://github.com/libsdl-org/SDL/archive/refs/tags/release-$portVersion.tar.gz"
CHECKSUM_SHA256="03f9d7c191a837525c9cda6406af2f2e48be02b5e7eb03d949cc9f1e9ca41c8b"
PATCHES="libsdl2-$portVersion.patchset"

View File

@@ -1,4 +1,4 @@
From c607af89d12a6d1d3243665ec824fa146597376d Mon Sep 17 00:00:00 2001
From 94e3ed77a9723e74b681358bec7dc6705b86c8f1 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 2 Apr 2024 19:02:04 +0200
Subject: fix gcc2 ICE
@@ -19,10 +19,10 @@ index 516be82..60f9d21 100644
Uint32 y, z;
x.f32 = src[i];
--
2.51.0
2.52.0
From 52efbed639d59df4ad0b1a685cf38c82ea97f817 Mon Sep 17 00:00:00 2001
From 879c0fb032e208de4e1237595cad8954f95a5841 Mon Sep 17 00:00:00 2001
From: PulkoMandy <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Mar 2024 16:45:42 +0100
Subject: Use a BHandler attached to the application instead of a BLooper
@@ -295,10 +295,10 @@ index 0ca751a..611022e 100644
static int _InitWindow(_THIS, SDL_Window *window) {
--
2.51.0
2.52.0
From b350148abc1c52e23261be7d221e679547485ab6 Mon Sep 17 00:00:00 2001
From 4087199e952712af6f9044f971b824e7295adc8c Mon Sep 17 00:00:00 2001
From: Peppersawce <michaelpeppers89@yahoo.it>
Date: Sat, 6 Dec 2025 11:35:16 +0100
Subject: Make BUrl not 'ambiguous'
@@ -337,5 +337,48 @@ index d541289..14ab252 100644
return (rc == B_NO_ERROR) ? 0 : SDL_SetError("URL open failed (err=%d)", (int)rc);
}
--
2.51.0
2.52.0
From 931a779f35719c59efba6859bc37241232838eda Mon Sep 17 00:00:00 2001
From: erysdren <contact@erysdren.me>
Date: Thu, 8 Jan 2026 04:18:45 -0600
Subject: fix modelist potential bogus free
diff --git a/src/video/haiku/SDL_bmodes.cc b/src/video/haiku/SDL_bmodes.cc
index 86c5d8a..053a1ca 100644
--- a/src/video/haiku/SDL_bmodes.cc
+++ b/src/video/haiku/SDL_bmodes.cc
@@ -244,17 +244,20 @@ void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
uint32 count, i;
/* Get graphics-hardware supported modes */
- bscreen.GetModeList(&bmodes, &count);
- bscreen.GetMode(&this_bmode);
-
- for (i = 0; i < count; ++i) {
- // FIXME: Apparently there are errors with colorspace changes
- if (bmodes[i].space == this_bmode.space) {
- _BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
- SDL_AddDisplayMode(display, &mode);
- }
+ if (bscreen.GetModeList(&bmodes, &count) == B_OK) {
+ if (bscreen.GetMode(&this_bmode) == B_OK) {
+ for (i = 0; i < count; ++i) {
+ // FIXME: Apparently there are errors with colorspace changes
+ if (bmodes[i].space == this_bmode.space) {
+ _BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
+ SDL_AddDisplayMode(display, &mode);
+ }
+ }
+ }
+ free(bmodes); /* This should not be SDL_free() */
}
- free(bmodes); /* This should not be SDL_free() */
}
--
2.52.0