SDL3: patch GetModeList potential bogus free (#13613)

This commit is contained in:
erysdren
2026-01-11 09:49:29 -06:00
committed by GitHub
parent 2120283054
commit eb46545307
2 changed files with 52 additions and 3 deletions

View File

@@ -6,7 +6,7 @@ software, emulators, and popular games."
HOMEPAGE="https://www.libsdl.org/" HOMEPAGE="https://www.libsdl.org/"
COPYRIGHT="1997-2025 Sam Lantinga" COPYRIGHT="1997-2025 Sam Lantinga"
LICENSE="Zlib" LICENSE="Zlib"
REVISION="1" REVISION="2"
SOURCE_URI="https://www.libsdl.org/release/SDL3-$portVersion.tar.gz" SOURCE_URI="https://www.libsdl.org/release/SDL3-$portVersion.tar.gz"
CHECKSUM_SHA256="1330671214d146f8aeb1ed399fc3e081873cdb38b5189d1f8bb6ab15bbc04211" CHECKSUM_SHA256="1330671214d146f8aeb1ed399fc3e081873cdb38b5189d1f8bb6ab15bbc04211"
PATCHES="libsdl3-$portVersion.patchset" PATCHES="libsdl3-$portVersion.patchset"

View File

@@ -1,4 +1,4 @@
From 73e260b8ae185d41adc293a22bc6cf261def5e43 Mon Sep 17 00:00:00 2001 From 242f30e9ce08cd51c39b49ab354ab0274f019daa Mon Sep 17 00:00:00 2001
From: Peppersawce <michaelpeppers89@yahoo.it> From: Peppersawce <michaelpeppers89@yahoo.it>
Date: Sat, 13 Dec 2025 17:56:10 +0100 Date: Sat, 13 Dec 2025 17:56:10 +0100
Subject: Make BUrl not 'ambiguous' again Subject: Make BUrl not 'ambiguous' again
@@ -37,5 +37,54 @@ index e9e9376..5d194c8 100644
if (rc != B_NO_ERROR) { if (rc != B_NO_ERROR) {
return SDL_SetError("URL open failed (err=%d)", (int)rc); return SDL_SetError("URL open failed (err=%d)", (int)rc);
-- --
2.51.0 2.52.0
From 02609cfd93c2e24b5db10092301be008ea203179 Mon Sep 17 00:00:00 2001
From: erysdren <contact@erysdren.me>
Date: Sun, 11 Jan 2026 03:46:54 -0600
Subject: fix modelist potential bogus free
diff --git a/src/video/haiku/SDL_bmodes.cc b/src/video/haiku/SDL_bmodes.cc
index 7397145..0b640c2 100644
--- a/src/video/haiku/SDL_bmodes.cc
+++ b/src/video/haiku/SDL_bmodes.cc
@@ -243,20 +243,23 @@ bool HAIKU_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
display_mode this_bmode;
display_mode *bmodes;
uint32 count, i;
+ bool result = false;
// 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_AddFullscreenDisplayMode(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_AddFullscreenDisplayMode(display, &mode);
+ }
+ }
+ result = true;
+ }
+ free(bmodes); // This should NOT be SDL_free()
}
- free(bmodes); // This should NOT be SDL_free()
- return true;
+ return result;
}
--
2.52.0