Page 1 of 1

Stupid issue with T1

Posted: Sat Jun 19, 2010 7:27 pm
by Lord Estraven
So I'm playing a mage in T1, aka Pernband. (Yes I know it's old. :P ) I hit m, a for my first spellbook, and then a for the first spell - while holding down the shift key, which *should* display the information on the spell, as with browsing the book. Instead, it causes T1 to crash immediately. If I invoke T1 from the console I get this rather cryptic error when it crashes:

Code: Select all

./tome: software bug 99 33
What does this mean and how can I fix it?

Re: Stupid issue with T1

Posted: Sat Jun 19, 2010 7:32 pm
by Lord Estraven
Update: GDB tells me this, for whatever it's worth:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
0xb7d4ea6d in vfprintf () from /lib/libc.so.6
Also, this is on Zenwalk 6.4, but the bug is observable on Slackware 13 and Arch Linux current.

Re: Stupid issue with T1

Posted: Mon Jun 21, 2010 1:18 am
by Yottle
I have no idea of what the problem is.

But your post reminded me of what a great game T1 was. I especially liked playing lost souls. I don't think a game ever lasted more than 15 minutes. And the more times I died, the harder it got.

Re: Stupid issue with T1

Posted: Tue Jun 22, 2010 4:40 pm
by Lord Estraven
Argh, this happens on the precompiled Windows version too. "tome.exe has experienced a severe error and must close" or whatever. Bleh.

Re: Stupid issue with T1

Posted: Sun Jun 27, 2010 8:06 pm
by Lord Estraven
Okay I think I found it. GDB backtrace says this:

Code: Select all

#3  0x0814e751 in vstrnfmt (
    buf=0xbfffeecf "Level 136049245 ?ยค\211\"\bpy\"\b8???", max=78, 
    fmt=0x81a5020 "Level %d %s %s (%d mana, %d%% fail)? ", 
    vp=0xbfffee84 "pb\034\b\001") at z-form.c:567
And look what's just above line 567?

Code: Select all

				/* Hack -- convert NULL to EMPTY */
				if (!arg) arg = "";
I'm not sure, but I THINK there ought to be a space between those quotes. Let's see if that fixes it.

Re: Stupid issue with T1

Posted: Sun Jun 27, 2010 8:10 pm
by Lord Estraven
... Nope, no fix. Dang.

Re: Stupid issue with T1

Posted: Wed Dec 14, 2011 11:32 pm
by Devorius
It looks like the code assumes that arg is guaranteed to exist at this point, and is inadvertently writing to some random memory that probably doesn't belong to the program. Also:

Code: Select all

fmt=0x81a5020 "Level %d %s %s (%d mana, %d%% fail)? ",
vp=0xbfffee84 "pb\034\b\001") at z-form.c:567
The format list is calling 5 variables: int, string, string, int, int
Yet the argument buffer contains only 4 arguments. So something is not getting passed correctly.