.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   HPB_bot (http://forums.bots-united.com/forumdisplay.php?f=35)
-   -   Interesting Stripper2 problem, maybe someone can help? (http://forums.bots-united.com/showthread.php?t=2708)

pl4tinum 26-09-2004 07:25

Interesting Stripper2 problem, maybe someone can help?
 
Hello,

I noticed something wierd today with Stripper2.

I am using the Linux version of Stripper2 (stripper2_mm_i386.so) on my linux gameserver. All of the _str.cfg files work perfectly with my maps on my server except those that are over 10kb in size. Each time one of the maps with a _str.cfg file over 10000 bytes loads up, the server crashes and restarts. If the file size is under 10000 bytes, it seems to be fine. I haven't tested with a file of size 9999 bytes but I'm assuming somewhere around 10000 is the breaking point. I know a map with _str.cfg file of 9465 bytes works just fine but the 4 maps I have with _str.cfg above that size level (between 10532 bytes and 15442 bytes) crash the server instantly.

If anyone has any idea as to what could be causing this... please let me know! I've been trying to figure it out and the servers logs leave me no information whatsoever on what could be the problem. I checked the sprite names and entity names in the _str.cfg files in question but they are all legit and should be fine.

Thanks again!

pl4tinum - Chris

sPlOrYgOn 26-09-2004 07:31

Re: Interesting Stripper2 problem, maybe someone can help?
 
it's probably because stripper 2 has a buffer size of that and if it goes over you'll be editing memory space not allocated for stripper 2 and windows will throw an exception or it will overwrite something critical for half-life to run normally and crash.

pl4tinum 26-09-2004 18:21

Re: Interesting Stripper2 problem, maybe someone can help?
 
Well the first part of what you said sounds good, how do I bump that buffer size up a notch? And it's Linux that I'm using... so I don't think Windows will crash hehe.

Pierre-Marie Baty 27-09-2004 15:32

Re: Interesting Stripper2 problem, maybe someone can help?
 
There must be a big buffer declared somewhere like this

char buffer[10000];

better do something like this

char *buffer;

buffer = (char *) malloc (min_size); // initialization

buffer = (char *) malloc (buffer, new_size); // reallocate each time you need the buffer to grow

free (buffer); // free the buffer when you don't need it anymore

pl4tinum 27-09-2004 19:17

Re: Interesting Stripper2 problem, maybe someone can help?
 
Interesting that the Linux version would have this limitation but not the Windows version. Could it be something related to the /tmp folder on my Linux drive? Maybe the server doesn't have access to create temporary files? I am not a programmer so for me to change the source and recompile is a little out of my league... at least I think it is. If I have GCC, is it fairly straightforward?



Quote:

Originally Posted by Pierre-Marie Baty
There must be a big buffer declared somewhere like this

char buffer[10000];

better do something like this

char *buffer;

buffer = (char *) malloc (min_size); // initialization

buffer = (char *) malloc (buffer, new_size); // reallocate each time you need the buffer to grow

free (buffer); // free the buffer when you don't need it anymore


pl4tinum 27-09-2004 20:05

Re: Interesting Stripper2 problem, maybe someone can help?
 
This seems to be the part of his code that actually reads in the Stripper _str.cfg files. The char input[1024] couldn't possibly be part of the problem could it?

bool scan_stripper_cfg(FILE *fp)
{
char input[1024];
char item_name[64];
int len, pos, index;
float percent;
while (!feof(fp))
{
if (fgets(input, 1023, fp) != NULL)
{
len = strlen(input);
if (input[len-1] == '\n')
input[len-1] = 0;
}
else
input[0] = 0;


What about this, do these seem fine?

#define MAX_STRIP_ITEMS 400
#define MAX_ADD_KEYVALUE 1000
#define MAX_ADD_ITEMS 400
#define MAX_ADD_GROUPS 100
#define MAX_PRECACHE_ITEMS 100

I honestly doubt there is anywhere close to 400 items in one of my maps. Maybe 150-200 but not 400. And I don't write [add] before every part so [add] groups should be only 1. Do you think maybe it's limiting to 100 items?

Pierre-Marie Baty 27-09-2004 23:29

Re: Interesting Stripper2 problem, maybe someone can help?
 
The scan_stripper_cfg function looks fine. I don't think anything should be changed there but for the sake of cleanliness and readability.

But I smell great chances that if you double all these MAX_stuff values, the program won't crash anymore. You need gcc-2.95.3 to compile plugins on Linux (and you probably need the metamod SDK too...)

pl4tinum 27-09-2004 23:55

Re: Interesting Stripper2 problem, maybe someone can help?
 
Thanks I will give it a shot. I appreciate the fast responses Pierre!!

pl4tinum 28-09-2004 02:46

Re: Interesting Stripper2 problem, maybe someone can help?
 
I'm assuming I need the Metamod source code too, is there anything else I need? Darn metamod.org is down...

sPlOrYgOn 28-09-2004 02:50

Re: Interesting Stripper2 problem, maybe someone can help?
 
http://sourceforge.net/projects/metamod


All times are GMT +2. The time now is 00:48.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.