Log in

View Full Version : Rev 127 Zone crash after looting an item


paaco
10-22-2008, 09:23 AM
Just upped to Rev 127. It compiled fine and runs stable for me. I killed a mob to check out the new link when looting items. As soon as you loot you get the link and zone.exe crashes. Nothing shows up in logs about the crash.

AndMetal
10-22-2008, 12:08 PM
Is anyone else having this problem? Before I committed the change, I compiled and tested on myself and it worked fine, but I didn't have a chance to test in a group.

cavedude
10-22-2008, 12:11 PM
I tried reproducing a crash using both clients in a group and was unable to.

AndMetal
10-22-2008, 12:24 PM
I tried reproducing a crash using both clients in a group and was unable to.

Same. I grouped 2 characters in Kael, killed a Giant w/ random loot, looted it, and it showed correctly on both characters (including clicking on the links).

The only thing that initially caused an issue was when I tried to initialize the string (which is actually char now) using NULL, which did cause the zone to crash, but not using a value to initialize it just generates a warning during compile.

Do you have any logs of the crash or any other information to help reproduce it?

So_1337
10-22-2008, 12:44 PM
Is this on the Titanium client?

paaco
10-22-2008, 12:49 PM
Bleh, I dunno why it crashes for me, I recompiled 2 times to make sure using VS 2005 Express. Same results both times, using titanium :(

paaco
10-22-2008, 12:51 PM
is compiling with Vs 2005 not supported? I get a ton of warnings, although it compiles succesfully. I was using 2008 and getting much less warnings, until my trial ran out and I switched to 2005 :(

Derision
10-22-2008, 12:56 PM
char *link;
sprintf(link, "%c%06X%s%s%c", ...


You are declaring link as a pointer to an array of characters, but not initialising it to a valid value, so it will point to a random position in memory.

You should declare it like char link[100]; (replacing 100 with whatever the maximum size of a link is).

paaco
10-22-2008, 01:05 PM
I'm no coding genius, so this may not be helpful at all. But it appears to be the part that Derision just mentioned. This is what pops up while zone is compiling and it gets to that part.

1>c:\eq\eqemuserver\zone\playercorpse.cpp(1005) : warning C4700: uninitialized local variable 'link' used

AndMetal
10-22-2008, 01:53 PM
You should declare it like char link[100]; (replacing 100 with whatever the maximum size of a link is).

My concern is that the link's length depends on the name of the item, since it is appended on the end, just before the terminating character 0x12. However, an item name should be a max of 64, so we could just set the length to 1+6+39+64+1 = 111.

I'll go ahead and compile the changes & see what happens.

Edit: we could use a string, like was done before, but it would be so much more of a pita to get it back to a predictable char.

Derision
10-22-2008, 01:56 PM
I'm not sure if your calculation include the `\0` terminator that sprintf will automatically put at the end of the string. If not, you should add 1 byte for that.

AndMetal
10-22-2008, 05:13 PM
I started with 111 (didn't realize the last byte added by sprintf at the time) and it works fine, primarily because the longest item name in the DB is 50 characters long:

mysql> SELECT id, Name, CHAR_LENGTH(Name) as Name_length FROM items ORDER BY Name_length DESC, id ASC LIMIT 5;
+-------+----------------------------------------------------+-------------+
| id | Name | Name_length |
+-------+----------------------------------------------------+-------------+
| 18557 | Prophecy of Vah: A History of the Vah Shir Vol.III | 50 |
| 20429 | Banner Material Kit: Focus of Benefit Conservation | 50 |
| 18556 | Prophecy of Vah: A History of the Vah Shir Vol.II | 49 |
| 46814 | Gnomework Model XVII's Experimental Plate Backing | 49 |
| 57937 | First Sisters of the Blackfeather Harpies Vol. II | 49 |
+-------+----------------------------------------------------+-------------+
5 rows in set (0.98 sec)


I'll get this updated into SVN once I have a chance to finish some other stuff (unless someone wants to take care of it first).

paaco
10-23-2008, 12:32 AM
Thanks for the fix Andmetal, took care of the problem I was having. I can now loot with Rev 129 :)