Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

basejk bug. will over write varables

Page: 1 of 1
 orion2486
06-24-2004, 11:35 PM
#1
wondering if anyone found this base jk bug, this is in both jk2 and jk3

in g_local.h

int numTeamVotingClients[2]; // set by CalculateRanks

in bg_public.h
enum {
TEAM_FREE,
TEAM_RED,
TEAM_BLUE,
TEAM_SPECTATOR,

TEAM_NUM_TEAMS
};

in g_main.c, Function CalculateRanks()


for (i = 0; i < TEAM_NUM_TEAMS; i++) {
level.numteamVotingClients[i] = 0;
}


While i was doing bug fixing for JAR 1.4. Getting ready for release, finally. I had right after the declartion of the numteamVotingClients some team locking bools, and i would notice that those bools would randomly get reset to qfalse. taht being the above for loop, loops 4 times while the array is two, thus going out of bounds and overwriting whatever is in the next 8 bytes of memory to zero. I've corrected this for JAR and for the next version of JA Mod, and if anyone else hasn't seen this error here you go. Ive done testing and you can either change the for loop to only execute 2 times, since any instance of that variable is only indexed at 0 and 1, or just make the array a size of 4.
 razorace
06-30-2004, 7:42 AM
#2
hmmm, interesting. I wasn't aware that you could do that. Thanks for the heads up. I've added this to OJP.
Page: 1 of 1