HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

passing an invalid string to ExecuteFunc

09-01-2004, 02:55 PM#1
fugly
is there anyway to detect if a string being passed to execute func is invalid cause it causes instant crash?, thx in advance =)
09-01-2004, 03:13 PM#2
AIAndy
Well, there might be one. The strings for the functions are actually in the strings table and they likely have a low number. So it might be possible to check for that with the return bug.
09-01-2004, 03:51 PM#3
Vexorian
Quote:
Originally Posted by AIAndy
Well, there might be one. The strings for the functions are actually in the strings table and they likely have a low number. So it might be possible to check for that with the return bug.
the return bug with strings is really risky, I don't reccomend it. And you shouldn't allow the game to give executefunc bad values if you do things right, likelly the string array / something should have DoNothing as default value or something like that
09-01-2004, 06:44 PM#4
fugly
well vex you do have the best answer and im probably going to end up having to go down that route, but aiandy were can i find this string table? cause if i could turn this into a function or a method it would probably be very helpful for alot of people
09-01-2004, 07:32 PM#5
AIAndy
There have been several investigations done with the return bug. When you use it on strings you get the same value for the same string content. So we assume that these values point to a string table where are strings are contained.
I know that all the function names are contained in there too so you could try to find out what numbers are assigned to them. Now that return value of strings has not been investigated thoroughly enough so it would be better to first try around with that stuff a bit more.
09-01-2004, 07:53 PM#6
fugly
so do you not know where this table is? sorry for being so persistant :( but i wanna figure this out, im going with just reducing the possible of a bad value being passed but this is still interesting.
09-01-2004, 08:08 PM#7
Vexorian
Quote:
Originally Posted by AIAndy
There have been several investigations done with the return bug. When you use it on strings you get the same value for the same string content. So we assume that these values point to a string table where are strings are contained.
I know that all the function names are contained in there too so you could try to find out what numbers are assigned to them. Now that return value of strings has not been investigated thoroughly enough so it would be better to first try around with that stuff a bit more.
yes, but what I found is that the values tend to change in game with strings, and that causes crashes (other wise I would have replaced strings with integers when loading gamecache
09-01-2004, 11:53 PM#8
AIAndy
Are you sure they change ?
09-02-2004, 12:23 PM#9
Vexorian
Quote:
Originally Posted by AIAndy
Are you sure they change ?
Yes, when I discovered that game cache integers are faster than strings, I thought about using the return bug to store integers instead of strings, then convert them back to strings.

Too bad the game was crashing for mysterius reasons, and only stopped crashing after I reverted the integers to strings.
09-02-2004, 12:29 PM#10
AIAndy
I guess investigating that behavior of the strings could be interesting. Might give us new insight into how strings work in War3.
09-02-2004, 11:14 PM#11
PigOrc95
The string table (the list of strings you get from using the return bug, may not be what you refer to as a string table AIAndy) is something like a dynamic array of strings. If you try to access an array element that is out of bounds the game crashes. Also everytime you output a string or enter a string in the chat, the array is incremented by that string.

You can instantaneously approximate the maximum size of the array by generating a random string and displaying it. Using this, I searched the array starting at 0 but found no names of functions?
09-03-2004, 12:04 AM#12
AIAndy
I am sure they are in there as I got them as a return for calling string returning common.j natives in AI (they return the wrong thing then). Else I'd not know how I got them then.