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
commite2e5ff01b42024cbbd6f290ec15b9c96eec22abe (patch)
tree8f27f6d3a19234687984a212042f221721ce22af /games-arcade
parentadd support for USE=static #78975 by Thomas Eckert (diff)
downloadhistorical-e2e5ff01b42024cbbd6f290ec15b9c96eec22abe.tar.gz
historical-e2e5ff01b42024cbbd6f290ec15b9c96eec22abe.tar.bz2
historical-e2e5ff01b42024cbbd6f290ec15b9c96eec22abe.zip
add patch to fix ammo overflow from Jason Bucata (bug #99395)
Package-Manager: portage-2.0.51.22-r2
Diffstat (limited to 'games-arcade')
-rw-r--r--games-arcade/project-starfighter/ChangeLog6
-rw-r--r--games-arcade/project-starfighter/Manifest5
-rw-r--r--games-arcade/project-starfighter/files/1.1-ammo.patch53
-rw-r--r--games-arcade/project-starfighter/project-starfighter-1.1.ebuild8
4 files changed, 66 insertions, 6 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/Manifest b/games-arcade/project-starfighter/Manifest
index c6fd09ea3ab6..6222d81ae3bb 100644
--- a/games-arcade/project-starfighter/Manifest
+++ b/games-arcade/project-starfighter/Manifest
@@ -1,4 +1,5 @@
-MD5 fe1af20c072246515e0fe87a7146d922 ChangeLog 1104
MD5 f17b9b8fa07a38914fe1c03268f51678 metadata.xml 158
-MD5 87869bd7a8a1a21723a2c3f146273c16 project-starfighter-1.1.ebuild 1045
+MD5 4fd8dd4669cc1eed20f69f6e3e4299e6 project-starfighter-1.1.ebuild 1090
+MD5 c1d9ada418e900f018d13c5762bc8fda ChangeLog 1281
MD5 bb378e90b01bf6ab749535df3e739943 files/digest-project-starfighter-1.1 76
+MD5 e87483f7d04fd6d00481168d7585c8e4 files/1.1-ammo.patch 1803
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() {