aboutsummaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
authorjbeich <jbeich@FreeBSD.org>2015-02-20 14:53:37 +0800
committerjbeich <jbeich@FreeBSD.org>2015-02-20 14:53:37 +0800
commit1f0329237ebdbc515c19ad095dc84190df27f796 (patch)
treea10f654d060210d22acc8cbd368563ab82fab1b6 /games
parent9f7c1470511587d23c37e5672f63ec42ac242ba2 (diff)
downloadfreebsd-ports-gnome-1f0329237ebdbc515c19ad095dc84190df27f796.tar.gz
freebsd-ports-gnome-1f0329237ebdbc515c19ad095dc84190df27f796.tar.zst
freebsd-ports-gnome-1f0329237ebdbc515c19ad095dc84190df27f796.zip
- Fix invalid dereferencing of null reference which causes startup
crash for cube_client when built with clang 3.6 + -O1 or higher [1] - Properly track libenet dependency [2] PR: 197604 [1] PR: 197605 [2] Submitted by: dim [1]
Diffstat (limited to 'games')
-rw-r--r--games/cube/Makefile5
-rw-r--r--games/cube/files/patch-entities.cpp15
-rw-r--r--games/cube/files/patch-physics.cpp22
-rw-r--r--games/cube/files/patch-protos.h11
-rw-r--r--games/cube/files/patch-rendermd2.cpp11
5 files changed, 62 insertions, 2 deletions
diff --git a/games/cube/Makefile b/games/cube/Makefile
index 637d2129978a..ec789a474b16 100644
--- a/games/cube/Makefile
+++ b/games/cube/Makefile
@@ -3,7 +3,7 @@
PORTNAME= cube
DISTVERSION= 2005_08_29
-PORTREVISION= 14
+PORTREVISION= 15
CATEGORIES= games
MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/${DISTVERSION}
DISTFILES= ${CUBE_DATA} ${CUBE_SRC}
@@ -11,9 +11,10 @@ DISTFILES= ${CUBE_DATA} ${CUBE_SRC}
MAINTAINER= ports@FreeBSD.org
COMMENT= OpenGL 3D FPS (first person shooter) game
-BUILD_DEPENDS= ${LOCALBASE}/lib/libenet.a:${PORTSDIR}/net/enet
+LIB_DEPENDS= libenet.so:${PORTSDIR}/net/enet
USES= dos2unix gmake
+EXTRACT_AFTER_ARGS=--exclude enet
ALL_TARGET= #
USE_XORG= x11
diff --git a/games/cube/files/patch-entities.cpp b/games/cube/files/patch-entities.cpp
new file mode 100644
index 000000000000..6d49d0fe6f76
--- /dev/null
+++ b/games/cube/files/patch-entities.cpp
@@ -0,0 +1,15 @@
+--- entities.cpp.orig 2015-02-14 01:42:48.128349000 +0100
++++ entities.cpp 2015-02-14 01:44:19.309526000 +0100
+@@ -25,9 +25,9 @@
+ entity &e = ents[i];
+ if(e.type==MAPMODEL)
+ {
+- mapmodelinfo &mmi = getmminfo(e.attr2);
+- if(!&mmi) continue;
+- rendermodel(mmi.name, 0, 1, e.attr4, (float)mmi.rad, e.x, (float)S(e.x, e.y)->floor+mmi.zoff+e.attr3, e.y, (float)((e.attr1+7)-(e.attr1+7)%15), 0, false, 1.0f, 10.0f, mmi.snap);
++ mapmodelinfo *mmi = getmminfo(e.attr2);
++ if(!mmi) continue;
++ rendermodel(mmi->name, 0, 1, e.attr4, (float)mmi->rad, e.x, (float)S(e.x, e.y)->floor+mmi->zoff+e.attr3, e.y, (float)((e.attr1+7)-(e.attr1+7)%15), 0, false, 1.0f, 10.0f, mmi->snap);
+ }
+ else
+ {
diff --git a/games/cube/files/patch-physics.cpp b/games/cube/files/patch-physics.cpp
new file mode 100644
index 000000000000..bc4cb6842d10
--- /dev/null
+++ b/games/cube/files/patch-physics.cpp
@@ -0,0 +1,22 @@
+--- physics.cpp.orig 2015-02-14 01:31:41.351723000 +0100
++++ physics.cpp 2015-02-14 01:40:28.770647000 +0100
+@@ -46,14 +46,14 @@
+ {
+ entity &e = ents[i];
+ if(e.type!=MAPMODEL) continue;
+- mapmodelinfo &mmi = getmminfo(e.attr2);
+- if(!&mmi || !mmi.h) continue;
+- const float r = mmi.rad+d->radius;
++ mapmodelinfo *mmi = getmminfo(e.attr2);
++ if(!mmi || !mmi->h) continue;
++ const float r = mmi->rad+d->radius;
+ if(fabs(e.x-d->o.x)<r && fabs(e.y-d->o.y)<r)
+ {
+- float mmz = (float)(S(e.x, e.y)->floor+mmi.zoff+e.attr3);
++ float mmz = (float)(S(e.x, e.y)->floor+mmi->zoff+e.attr3);
+ if(d->o.z-d->eyeheight<mmz) { if(mmz<hi) hi = mmz; }
+- else if(mmz+mmi.h>lo) lo = mmz+mmi.h;
++ else if(mmz+mmi->h>lo) lo = mmz+mmi->h;
+ };
+ };
+ };
diff --git a/games/cube/files/patch-protos.h b/games/cube/files/patch-protos.h
new file mode 100644
index 000000000000..15af2f48dfd5
--- /dev/null
+++ b/games/cube/files/patch-protos.h
@@ -0,0 +1,11 @@
+--- protos.h.orig 2015-02-14 01:31:41.352230000 +0100
++++ protos.h 2015-02-14 01:39:01.934630000 +0100
+@@ -192,7 +192,7 @@
+
+ // rendermd2
+ extern void rendermodel(char *mdl, int frame, int range, int tex, float rad, float x, float y, float z, float yaw, float pitch, bool teammate, float scale, float speed, int snap = 0, int basetime = 0);
+-extern mapmodelinfo &getmminfo(int i);
++extern mapmodelinfo *getmminfo(int i);
+
+ // server
+ extern void initserver(bool dedicated, int uprate, char *sdesc, char *ip, char *master, char *passwd, int maxcl);
diff --git a/games/cube/files/patch-rendermd2.cpp b/games/cube/files/patch-rendermd2.cpp
new file mode 100644
index 000000000000..cf11bccca5f0
--- /dev/null
+++ b/games/cube/files/patch-rendermd2.cpp
@@ -0,0 +1,11 @@
+--- rendermd2.cpp.orig 2015-02-14 01:31:41.354388000 +0100
++++ rendermd2.cpp 2015-02-14 01:39:38.592584000 +0100
+@@ -234,7 +234,7 @@
+
+ void mapmodelreset() { mapmodels.setsize(0); };
+
+-mapmodelinfo &getmminfo(int i) { return i<mapmodels.length() ? mapmodels[i]->mmi : *(mapmodelinfo *)0; };
++mapmodelinfo *getmminfo(int i) { return i<mapmodels.length() ? &mapmodels[i]->mmi : 0; };
+
+ COMMAND(mapmodel, ARG_5STR);
+ COMMAND(mapmodelreset, ARG_NONE);