public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-perl/SDL/files/, dev-perl/SDL/
@ 2015-11-02 23:17 Michael Sterrett
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Sterrett @ 2015-11-02 23:17 UTC (permalink / raw
  To: gentoo-commits

commit:     688f22134d20aae2ba8e06de241b2563f74782a9
Author:     Michael Sterrett <mr_bones_ <AT> gentoo <DOT> org>
AuthorDate: Mon Nov  2 23:16:43 2015 +0000
Commit:     Michael Sterrett <mr_bones_ <AT> gentoo <DOT> org>
CommitDate: Mon Nov  2 23:17:04 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=688f2213

version bump

Package-Manager: portage-2.2.20.1

 dev-perl/SDL/Manifest                      |  1 +
 dev-perl/SDL/SDL-2.546.ebuild              | 42 ++++++++++++++++++++++++++++++
 dev-perl/SDL/files/SDL-2.546-pointer.patch | 29 +++++++++++++++++++++
 3 files changed, 72 insertions(+)

diff --git a/dev-perl/SDL/Manifest b/dev-perl/SDL/Manifest
index b8dda29..9eda148 100644
--- a/dev-perl/SDL/Manifest
+++ b/dev-perl/SDL/Manifest
@@ -1,2 +1,3 @@
 DIST SDL-2.540.tar.gz 2490785 SHA256 031866be84e6bbd7bb082aed26265ad64f84dc867db5239476921746a41e6a1f SHA512 6c85ea179174415da40fe20f27086626b56570d8dbb6416957fb3236550d27ad893f171c7aedf7c6cda2ca6f2078dfad5d8813e428b49c920c1f8487416193b3 WHIRLPOOL 1cf79640cf56237f7ed439cd2c13ef60e4978762867495d50ad7db06f75685022fb4409265ef4243bdb688c467eb66acbeab40e18ee5f688511f1e60a52894f9
 DIST SDL-2.544.tar.gz 2487263 SHA256 3878d7171c7fb34b5d35f9ef3883e532fb44188c666f7492ce2bf14f5acad096 SHA512 df8a6cc1f395e143bfa59f08a0c91c640b83463742250f5ea545dcde1d7b3f819dcae03535e62f572ae2d7ad3bbc988b034a1c83a451926f6ec2d5e11ae90ddc WHIRLPOOL 667675bb12a3b6957848de0616f158f36b9f6a14b5ea0af68e3f14839dc8b24a810b51b3f06fc2f3695a060991ae58fdb9f75ba7d221e42c51032752b0592b71
+DIST SDL-2.546.tar.gz 2487053 SHA256 e08aa73550b3f8d32ced0941c3c629f01c4ba4d480fc269e57f3fa6f8df86631 SHA512 7f7015c90a277b91951a2357bcdf7c3f2f930270d211657c903240ed4529f408c200337ca79e4971eb3912da28ebf1e950053ce4d763c2599c701444c618c71a WHIRLPOOL f5afa1710321c08f57da105ed20953bffc9b534f3ab7c5fc6d729285b4e28f2ee58763f82ed88d9e0c2167ce7d8d182c0fc3259c4cb798ce17ffa79e306df54c

diff --git a/dev-perl/SDL/SDL-2.546.ebuild b/dev-perl/SDL/SDL-2.546.ebuild
new file mode 100644
index 0000000..8d36ad9
--- /dev/null
+++ b/dev-perl/SDL/SDL-2.546.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+MODULE_AUTHOR=FROGGS
+inherit perl-module
+
+DESCRIPTION="Simple DirectMedia Layer (SDL) bindings for perl"
+HOMEPAGE="http://sdl.perl.org/ http://search.cpan.org/dist/SDL/ https://github.com/PerlGameDev/SDL"
+
+LICENSE="GPL-2 OFL-1.1"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~x86"
+IUSE=""
+
+RDEPEND=">=dev-perl/Alien-SDL-1.434
+	dev-perl/Capture-Tiny
+	dev-perl/File-ShareDir
+	dev-perl/Test-Most
+	dev-perl/Tie-Simple
+	media-libs/libpng:0
+	media-libs/libsdl
+	media-libs/sdl-gfx
+	media-libs/sdl-image
+	media-libs/sdl-mixer
+	media-libs/sdl-pango
+	media-libs/sdl-ttf
+	media-libs/smpeg
+	media-libs/tiff:0
+	virtual/glu
+	virtual/jpeg:0
+	virtual/opengl
+	virtual/perl-ExtUtils-CBuilder
+	>=dev-perl/Module-Build-0.400.0
+	virtual/perl-Scalar-List-Utils
+	virtual/perl-Test-Simple"
+DEPEND=${RDEPEND}
+
+SRC_TEST=parallel
+mydoc='CHANGELOG README TODO'
+PATCHES=( "${FILESDIR}"/${P}-pointer.patch )

diff --git a/dev-perl/SDL/files/SDL-2.546-pointer.patch b/dev-perl/SDL/files/SDL-2.546-pointer.patch
new file mode 100644
index 0000000..b3721ac
--- /dev/null
+++ b/dev-perl/SDL/files/SDL-2.546-pointer.patch
@@ -0,0 +1,29 @@
+--- ./src/Core/objects/Event.xs.orig	2015-11-02 17:32:54.831820664 -0500
++++ ./src/Core/objects/Event.xs	2015-11-02 17:33:35.802090936 -0500
+@@ -611,7 +611,7 @@
+ 		char *CLASS = "SDL::JoyHatEvent";
+ 	CODE:
+ 		RETVAL = NULL;
+-		if ( &event != NULL ) 
++		if ( event ) 
+ 		RETVAL = &(event->jhat);
+ 	OUTPUT:
+ 		RETVAL
+@@ -683,7 +683,7 @@
+ 		char *CLASS = "SDL::JoyButtonEvent";
+ 	CODE:
+ 		RETVAL = NULL;
+-		if ( &event != NULL ) 
++		if ( event ) 
+ 		RETVAL = &(event->jbutton);
+ 	OUTPUT:
+ 		RETVAL
+@@ -755,7 +755,7 @@
+ 		char *CLASS = "SDL::ResizeEvent";
+ 	CODE:
+ 		RETVAL = NULL;
+-		if ( &event != NULL ) 
++		if ( event ) 
+ 		RETVAL = &(event->resize);
+ 	OUTPUT:
+ 		RETVAL


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-perl/SDL/files/, dev-perl/SDL/
@ 2023-10-16 23:01 James Le Cuirot
  0 siblings, 0 replies; 3+ messages in thread
From: James Le Cuirot @ 2023-10-16 23:01 UTC (permalink / raw
  To: gentoo-commits

commit:     ef322d4cfd144c61c1bd7c51fd8ff7018f55b752
Author:     Haelwenn (lanodan) Monnier <contact <AT> hacktivis <DOT> me>
AuthorDate: Thu Oct 12 20:47:46 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Mon Oct 16 22:59:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef322d4c

dev-perl/SDL: Fix for Perl 5.37.1+

Taken from https://github.com/PerlGameDev/SDL/pull/304

Signed-off-by: Haelwenn (lanodan) Monnier <contact <AT> hacktivis.me>
Closes: https://github.com/gentoo/gentoo/pull/33317
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 dev-perl/SDL/SDL-2.548.0-r2.ebuild               |  1 +
 dev-perl/SDL/files/SDL-2.548-perl537_sv_nv.patch | 65 ++++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/dev-perl/SDL/SDL-2.548.0-r2.ebuild b/dev-perl/SDL/SDL-2.548.0-r2.ebuild
index 2d1e3ed28ed2..fb0d8ac093be 100644
--- a/dev-perl/SDL/SDL-2.548.0-r2.ebuild
+++ b/dev-perl/SDL/SDL-2.548.0-r2.ebuild
@@ -52,4 +52,5 @@ PERL_RM_FILES=(
 PATCHES=(
 	"${FILESDIR}"/${PN}-2.546-pointer.patch
 	"${FILESDIR}"/${PN}-2.546-implicit-func-decl.patch
+	"${FILESDIR}"/${PN}-2.548-perl537_sv_nv.patch
 )

diff --git a/dev-perl/SDL/files/SDL-2.548-perl537_sv_nv.patch b/dev-perl/SDL/files/SDL-2.548-perl537_sv_nv.patch
new file mode 100644
index 000000000000..7ca3914eed6f
--- /dev/null
+++ b/dev-perl/SDL/files/SDL-2.548-perl537_sv_nv.patch
@@ -0,0 +1,65 @@
+From d734d03862d7dcc776bd2fa3ba662cdd5879b32e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Source: https://github.com/PerlGameDev/SDL/pull/304
+Date: Wed, 12 Jul 2023 17:55:27 +0200
+Subject: [PATCH] Adapt to perl 5.37.1
+
+Perl 5.37.1 removed a deprecated sv_nv() macro and SDL fails to build
+with Perl 5.38.0:
+
+lib/SDLx/Controller/Interface.xs:60:26: error: implicit declaration of function 'sv_nv'
+   60 |         out->dv_x      = sv_nv(temp);
+      |                          ^~~~~
+
+Users are advised to use SvNVx() macro instead. SvNVx() seems to have been
+available all the time (it predates a commit from 1993-10-07).
+
+This patch does that.
+
+https://github.com/PerlGameDev/SDL/issues/303
+---
+ src/SDLx/Controller/Interface.xs | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/SDLx/Controller/Interface.xs b/src/SDLx/Controller/Interface.xs
+index 3dc202b7..d326c885 100644
+--- a/src/SDLx/Controller/Interface.xs
++++ b/src/SDLx/Controller/Interface.xs
+@@ -57,15 +57,15 @@ void evaluate(SDLx_Interface *obj, SDLx_Derivative *out, SDLx_State *initial, fl
+ 
+ 	SV *temp;
+ 	temp           = av_pop(accel);
+-	out->dv_x      = sv_nv(temp);
++	out->dv_x      = SvNVx(temp);
+ 	SvREFCNT_dec(temp);
+ 
+ 	temp           = av_pop(accel);
+-	out->dv_y      = sv_nv(temp);
++	out->dv_y      = SvNVx(temp);
+ 	SvREFCNT_dec(temp);
+ 
+ 	temp           = av_pop(accel);
+-	out->dang_v    = sv_nv(temp);
++	out->dang_v    = SvNVx(temp);
+ 	SvREFCNT_dec(temp);
+ 
+ 	SvREFCNT_dec((SV *)accel);
+@@ -90,15 +90,15 @@ void evaluate_dt(SDLx_Interface *obj, SDLx_Derivative *out, SDLx_State *initial,
+ 
+ 	SV *temp;
+ 	temp           = av_pop(accel);
+-	out->dv_x      = sv_nv(temp);
++	out->dv_x      = SvNVx(temp);
+ 	SvREFCNT_dec(temp);
+ 
+ 	temp           = av_pop(accel);
+-	out->dv_y      = sv_nv(temp);
++	out->dv_y      = SvNVx(temp);
+ 	SvREFCNT_dec(temp);
+ 
+ 	temp           = av_pop(accel);
+-	out->dang_v    = sv_nv(temp);
++	out->dang_v    = SvNVx(temp);
+ 	SvREFCNT_dec(temp);
+ 
+ 	SvREFCNT_dec((SV *)accel);


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-perl/SDL/files/, dev-perl/SDL/
@ 2024-05-02  6:36 Sam James
  0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2024-05-02  6:36 UTC (permalink / raw
  To: gentoo-commits

commit:     d6f2d78341d72d6ec6cbb561ec26dd7f896b7df9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu May  2 06:35:03 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu May  2 06:35:46 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6f2d783

dev-perl/SDL: try more memory safety fixes

Debian are using these. I still get a UAF in the tests though.

Bug: https://bugs.gentoo.org/907609
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-perl/SDL/SDL-2.548.0-r3.ebuild             |  58 +++++++++++
 dev-perl/SDL/files/SDL-2.548-refcount.patch    |  27 ++++++
 dev-perl/SDL/files/SDL-2.548-uaf-surface.patch | 127 +++++++++++++++++++++++++
 3 files changed, 212 insertions(+)

diff --git a/dev-perl/SDL/SDL-2.548.0-r3.ebuild b/dev-perl/SDL/SDL-2.548.0-r3.ebuild
new file mode 100644
index 000000000000..51fadb44ea35
--- /dev/null
+++ b/dev-perl/SDL/SDL-2.548.0-r3.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DIST_AUTHOR=FROGGS
+DIST_VERSION=2.548
+inherit perl-module
+
+DESCRIPTION="Simple DirectMedia Layer (SDL) bindings for perl"
+HOMEPAGE="http://sdl.perl.org/ https://search.cpan.org/dist/SDL/ https://github.com/PerlGameDev/SDL"
+
+LICENSE="GPL-2 OFL-1.1"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~x86"
+
+RDEPEND="
+	>=dev-perl/Alien-SDL-1.446
+	dev-perl/Capture-Tiny
+	>=virtual/perl-CPAN-1.920.0
+	>=virtual/perl-ExtUtils-CBuilder-0.260.301
+	>=dev-perl/File-ShareDir-1.0.0
+	>=dev-perl/Module-Build-0.400.0
+	media-libs/libjpeg-turbo
+	virtual/perl-Scalar-List-Utils
+	dev-perl/Tie-Simple
+	media-libs/libpng:0
+	media-libs/libsdl
+	media-libs/sdl-gfx
+	media-libs/sdl-image
+	media-libs/sdl-mixer
+	media-libs/sdl-pango
+	media-libs/sdl-ttf
+	media-libs/smpeg
+	media-libs/tiff:0
+	virtual/glu
+	virtual/opengl
+"
+BDEPEND="${RDEPEND}
+	test? (
+		>=dev-perl/Test-Most-0.210.0
+	)
+"
+
+mydoc='CHANGELOG README TODO'
+
+PERL_RM_FILES=(
+	# Hangs, see bug #892011 and https://aur.archlinux.org/packages/perl-sdl#comment-903413.
+	t/core_video.t
+)
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.546-pointer.patch
+	"${FILESDIR}"/${PN}-2.546-implicit-func-decl.patch
+	"${FILESDIR}"/${PN}-2.548-perl537_sv_nv.patch
+	"${FILESDIR}"/${PN}-2.548-refcount.patch
+	"${FILESDIR}"/${PN}-2.548-uaf-surface.patch
+)

diff --git a/dev-perl/SDL/files/SDL-2.548-refcount.patch b/dev-perl/SDL/files/SDL-2.548-refcount.patch
new file mode 100644
index 000000000000..af150e35d2ba
--- /dev/null
+++ b/dev-perl/SDL/files/SDL-2.548-refcount.patch
@@ -0,0 +1,27 @@
+https://github.com/PerlGameDev/SDL/pull/308
+
+From fbf151a7481a5fda88bfe766d826fe55476cf4af Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Thu, 28 Mar 2024 13:21:47 +0000
+Subject: [PATCH] Fix reference-counting in set_event_filter
+
+This previously resulted in the following test failure with Perl 5.38.2
+on Debian unstable (https://bugs.debian.org/1064761):
+
+    t/core_events.t ................. 1/? Can't use an undefined value as a subroutine reference during global destruction.
+    t/core_events.t ................. Dubious, test returned 22 (wstat 5632, 0x1600)
+    All 691 subtests passed
+            (less 1 skipped subtest: 690 okay)
+--- a/src/Core/Events.xs
++++ b/src/Core/Events.xs
+@@ -102,7 +102,8 @@ void
+ events_set_event_filter(callback)
+ 	SV* callback
+ 	CODE:
+-		eventfiltersv = callback;
++		SvREFCNT_dec(eventfiltersv);
++		eventfiltersv = SvREFCNT_inc_simple(callback);
+ 		SDL_SetEventFilter((SDL_EventFilter) eventfilter_cb);
+ 
+ AV *
+

diff --git a/dev-perl/SDL/files/SDL-2.548-uaf-surface.patch b/dev-perl/SDL/files/SDL-2.548-uaf-surface.patch
new file mode 100644
index 000000000000..d64d27eab89b
--- /dev/null
+++ b/dev-perl/SDL/files/SDL-2.548-uaf-surface.patch
@@ -0,0 +1,127 @@
+https://github.com/PerlGameDev/SDL/pull/306
+https://github.com/PerlGameDev/SDL/issues/305
+https://github.com/libsdl-org/sdl12-compat/issues/305
+
+From e9b907c08d9fcce4fccb3084ff38e65cb5c6828b Mon Sep 17 00:00:00 2001
+From: Simon McVittie <smcv@debian.org>
+Date: Tue, 18 Jul 2023 18:00:12 +0100
+Subject: [PATCH] Distinguish between owned and borrowed references to a
+ SDL_Surface
+
+In many SDL APIs that return a SDL_Surface *, the surface is considered
+to be owned by the caller, and must be freed by the caller.
+
+However, SDL_SetVideoMode and presumably SDL_GetVideoSurface return
+a pointer to SDL's internal video surface, which will be freed by SDL
+if necessary, and must not be freed by library users.
+Incorrectly freeing this surface can lead to a use-after-free crash,
+manifesting as a test failure in t/core_video.t.
+
+See also https://github.com/libsdl-org/sdl12-compat/issues/305
+
+Resolves: https://github.com/PerlGameDev/SDL/issues/305
+Signed-off-by: Simon McVittie <smcv@debian.org>
+---
+ src/Core/Video.xs |  6 ++++--
+ src/helper.h      |  7 ++++---
+ typemap           | 23 +++++++++++++++++++++++
+ 3 files changed, 31 insertions(+), 5 deletions(-)
+
+diff --git a/src/Core/Video.xs b/src/Core/Video.xs
+index 8efa4b4a..e0d1a679 100644
+--- a/src/Core/Video.xs
++++ b/src/Core/Video.xs
+@@ -10,6 +10,8 @@
+ 
+ #include <SDL.h>
+ 
++typedef SDL_Surface SDL_Surface_borrowed;
++
+ void _uinta_free(Uint16* av, int len_from_av_len)
+ {
+ 	if( av != NULL)
+@@ -56,7 +58,7 @@ See: L<http:/*www.libsdl.org/cgi/docwiki.cgi/SDL_API#head-813f033ec44914f267f321
+ 
+ =cut
+ 
+-SDL_Surface *
++SDL_Surface_borrowed *
+ video_get_video_surface()
+ 	PREINIT:
+ 		char* CLASS = "SDL::Surface";
+@@ -125,7 +127,7 @@ video_video_mode_ok ( width, height, bpp, flags )
+ 		RETVAL
+ 
+ 
+-SDL_Surface *
++SDL_Surface_borrowed *
+ video_set_video_mode ( width, height, bpp, flags )
+ 	int width
+ 	int height
+diff --git a/src/helper.h b/src/helper.h
+index 1d2ee9a5..6b8e4ab5 100644
+--- a/src/helper.h
++++ b/src/helper.h
+@@ -58,12 +58,13 @@ void objDESTROY(SV *bag, void (* callback)(void *object))
+         Uint32 *threadid = (Uint32*)(pointers[2]);
+         
+         if(PERL_GET_CONTEXT == pointers[1]
+-        && *threadid == SDL_ThreadID())
++        && (threadid == NULL || *threadid == SDL_ThreadID()))
+         {
+             pointers[0] = NULL;
+-            if(object)
++            if(object && threadid != NULL)
+                 callback(object);
+-            safefree(threadid);
++            if (threadid != NULL)
++                safefree(threadid);
+             safefree(pointers);
+         }
+     }
+diff --git a/typemap b/typemap
+index c3ba997a..85a19265 100644
+--- a/typemap
++++ b/typemap
+@@ -34,6 +34,7 @@ SDL_UserEvent * 	O_OBJECT
+ SDL_QuitEvent * 	O_OBJECT
+ SDL_keysym *		O_OBJECT
+ SDL_Surface *		O_OBJECT
++SDL_Surface_borrowed *	O_BORROWED
+ SDL_SysWMmsg *		T_PTR
+ SDL_CD *		O_OBJECT
+ SDL_CDtrack *		O_OBJECT
+@@ -122,6 +123,17 @@ O_OBJECT
+         XSRETURN_UNDEF;
+     }
+ 
++O_BORROWED
++    if ($var) {
++        void** pointers  = malloc(3 * sizeof(void*));
++        pointers[0]      = (void*)$var;
++        pointers[1]      = (void*)PERL_GET_CONTEXT;
++        pointers[2]      = NULL;
++        sv_setref_pv( $arg, CLASS, (void*)pointers );
++    } else {
++        XSRETURN_UNDEF;
++    }
++
+ INPUT
+ 
+ O_OBJECT_NPGC
+@@ -136,3 +148,14 @@ O_OBJECT
+     } else {
+         XSRETURN_UNDEF;
+     }
++
++O_BORROWED
++    /* Same as O_OBJECT */
++    if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) {
++        void** pointers = (void**)INT2PTR(void *, SvIV((SV *)SvRV( $arg )));
++        $var = ($type)(pointers[0]);
++    } else if ($arg == 0) {
++        XSRETURN(0);
++    } else {
++        XSRETURN_UNDEF;
++    }
+


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-02  6:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-02 23:17 [gentoo-commits] repo/gentoo:master commit in: dev-perl/SDL/files/, dev-perl/SDL/ Michael Sterrett
  -- strict thread matches above, loose matches on Subject: below --
2023-10-16 23:01 James Le Cuirot
2024-05-02  6:36 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox