1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-23 04:23:08 +00:00

- 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]
This commit is contained in:
Jan Beich 2015-02-20 06:53:37 +00:00
parent 00b407013b
commit 6047e60d75
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=379412
5 changed files with 62 additions and 2 deletions

View File

@ -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

View File

@ -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
{

View File

@ -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;
};
};
};

View File

@ -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);

View File

@ -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);