Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mupen64plus: Fix crash due to SDL_SetVideoMode in SDL 2 compatibility code #40073

Merged
merged 1 commit into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 9d016ace855b88916746837b1a424cf9e5960c3b Mon Sep 17 00:00:00 2001
From: Dexter Gaon-Shatford <dexter@gaonshatford.ca>
Date: Thu, 20 Oct 2022 20:06:16 -0400
Subject: [PATCH] Fix wrong pitch argument in call to SDL_CreateRGBSurfaceFrom.

This patch makes the change in
https://github.com/mupen64plus/mupen64plus-core/pull/970 compatible with
the source distribution of mupen64plus v2.5.9.

This patch should be removed when the next version of mupen64plus is
released since it will already contain the changes from the PR mentioned
above.
---
src/api/vidext_sdl2_compat.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/source/mupen64plus-core/src/api/vidext_sdl2_compat.h b/source/mupen64plus-core/src/api/vidext_sdl2_compat.h
index 06d778dd..7cbd5963 100644
--- a/source/mupen64plus-core/src/api/vidext_sdl2_compat.h
+++ b/source/mupen64plus-core/src/api/vidext_sdl2_compat.h
@@ -474,8 +474,9 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
if (SDL_GL_MakeCurrent(SDL_VideoWindow, SDL_VideoContext) < 0) {
return NULL;
}
+ int pitch = (bpp + 7) / 8 * width;
SDL_VideoSurface =
- SDL_CreateRGBSurfaceFrom(NULL, width, height, bpp, 0, 0, 0, 0, 0);
+ SDL_CreateRGBSurfaceFrom(NULL, width, height, bpp, pitch, 0, 0, 0, 0);
if (!SDL_VideoSurface) {
return NULL;
}
--
2.38.1

2 changes: 1 addition & 1 deletion srcpkgs/mupen64plus/template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Template file for 'mupen64plus'
pkgname=mupen64plus
version=2.5.9
revision=2
revision=3
archs="x86_64* i686*"
wrksrc="mupen64plus-bundle-src-${version}"
hostmakedepends="pkg-config which nasm"
Expand Down