summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sterrett <mr_bones_@gentoo.org>2005-07-22 04:12:40 +0000
committerMichael Sterrett <mr_bones_@gentoo.org>2005-07-22 04:12:40 +0000
commitc3a0ec740c0676050ef32c30fe4ca24dcc030baf (patch)
treef973c3b8a9b639148c9a0b4a7e257ecc1a11d916 /games-arcade/project-starfighter
parentadd support for USE=static #78975 by Thomas Eckert (diff)
downloadgentoo-2-c3a0ec740c0676050ef32c30fe4ca24dcc030baf.tar.gz
gentoo-2-c3a0ec740c0676050ef32c30fe4ca24dcc030baf.tar.bz2
gentoo-2-c3a0ec740c0676050ef32c30fe4ca24dcc030baf.zip
add patch to fix ammo overflow from Jason Bucata (bug #99395)
(Portage version: 2.0.51.22-r2)
Diffstat (limited to 'games-arcade/project-starfighter')
-rw-r--r--games-arcade/project-starfighter/ChangeLog6
-rw-r--r--games-arcade/project-starfighter/files/1.1-ammo.patch53
-rw-r--r--games-arcade/project-starfighter/project-starfighter-1.1.ebuild8
3 files changed, 63 insertions, 4 deletions
diff --git a/games-arcade/project-starfighter/ChangeLog b/games-arcade/project-starfighter/ChangeLog
index 90aa6eee0df8..1ce6a9981178 100644
--- a/games-arcade/project-starfighter/ChangeLog
+++ b/games-arcade/project-starfighter/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for games-arcade/project-starfighter
# Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/games-arcade/project-starfighter/ChangeLog,v 1.8 2005/02/12 19:46:04 mr_bones_ Exp $
+# $Header: /var/cvsroot/gentoo-x86/games-arcade/project-starfighter/ChangeLog,v 1.9 2005/07/22 04:12:40 mr_bones_ Exp $
+
+ 22 Jul 2005; Michael Sterrett <mr_bones_@gentoo.org>
+ +files/1.1-ammo.patch, project-starfighter-1.1.ebuild:
+ add patch to fix ammo overflow from Jason Bucata (bug #99395)
12 Feb 2005; Michael Sterrett <mr_bones_@gentoo.org>
-project-starfighter-1.00.ebuild, project-starfighter-1.1.ebuild:
diff --git a/games-arcade/project-starfighter/files/1.1-ammo.patch b/games-arcade/project-starfighter/files/1.1-ammo.patch
new file mode 100644
index 000000000000..c1b74c12c683
--- /dev/null
+++ b/games-arcade/project-starfighter/files/1.1-ammo.patch
@@ -0,0 +1,53 @@
+diff -ur orig/code/classes.h p1/code/classes.h
+--- orig/code/classes.h 2003-08-18 07:48:23.000000000 -0500
++++ p1/code/classes.h 2005-07-17 22:21:34.000000000 -0500
+@@ -91,6 +91,33 @@
+
+ public:
+
++ // Added July 2005 by Jason Bucata (jbucata@tulsaconnect.com)
++ // Needed to avoid type over/underflow in addition.
++ // I'm using references as that's more idiomatic C++
++ // (though I'm avoiding the temptation to try out templates here).
++
++ static void safeAdd(signed char& in, signed char add, int low, int high)
++ {
++ int temp = ((int)in) + ((int)add);
++ if (temp < low)
++ in = low;
++ else if (temp > high)
++ in = high;
++ else
++ in = temp;
++ }
++
++ static void safeAdd(unsigned char& in, unsigned char add, int low, int high)
++ {
++ int temp = ((int)in) + ((int)add);
++ if (temp < low)
++ in = low;
++ else if (temp > high)
++ in = high;
++ else
++ in = temp;
++ }
++
+ static void limitChar(signed char *in, int low, int high)
+ {
+ if (*in < low)
+diff -ur orig/code/collectable.cpp p1/code/collectable.cpp
+--- orig/code/collectable.cpp 2003-08-18 07:48:23.000000000 -0500
++++ p1/code/collectable.cpp 2005-07-17 22:24:18.000000000 -0500
+@@ -345,7 +345,11 @@
+ break;
+
+ case P_PLASMA_AMMO:
+- Math::limitChar(&(player.ammo[0] += collectable->value), 0, currentGame.maxPlasmaAmmo);
++ // Changed July 2005 by Jason Bucata (jbucata@tulsaconnect.com)
++ // Use safeAdd to avoid byte overflow in the add
++ // before it can be corrected by the applied limits.
++ //Math::limitChar(&(player.ammo[0] += collectable->value), 0, currentGame.maxPlasmaAmmo);
++ Math::safeAdd(player.ammo[0], collectable->value, 0, currentGame.maxPlasmaAmmo);
+ if (player.ammo[0] == currentGame.maxPlasmaAmmo)
+ sprintf(temp, "Plasma cells at Maximum");
+ else
diff --git a/games-arcade/project-starfighter/project-starfighter-1.1.ebuild b/games-arcade/project-starfighter/project-starfighter-1.1.ebuild
index d96e889c90e5..099a53df089c 100644
--- a/games-arcade/project-starfighter/project-starfighter-1.1.ebuild
+++ b/games-arcade/project-starfighter/project-starfighter-1.1.ebuild
@@ -1,11 +1,10 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/games-arcade/project-starfighter/project-starfighter-1.1.ebuild,v 1.10 2005/02/12 19:46:04 mr_bones_ Exp $
+# $Header: /var/cvsroot/gentoo-x86/games-arcade/project-starfighter/project-starfighter-1.1.ebuild,v 1.11 2005/07/22 04:12:40 mr_bones_ Exp $
-inherit games
+inherit eutils games
MY_P=${P/project-/}
-S="${WORKDIR}/${MY_P}"
DESCRIPTION="A space themed shooter"
HOMEPAGE="http://www.parallelrealities.co.uk/starfighter.php"
# FIXME: Parallel Realities uses a lame download script.
@@ -20,12 +19,15 @@ DEPEND="media-libs/libsdl
media-libs/sdl-image
media-libs/sdl-mixer"
+S=${WORKDIR}/${MY_P}
+
src_unpack() {
unpack ${A}
cd "${S}"
sed -i \
-e "s-O3${CXXFLAGS}" makefile \
|| die "sed makefile failed"
+ epatch "${FILESDIR}"/${PV}-ammo.patch
}
src_compile() {