ToME: the Tales of Maj'Eyal
http://forums.te4.org/

ToME 2.3.5 - Crash on Save/Load
http://forums.te4.org/viewtopic.php?f=1&t=45084
Page 1 of 1

Author:  Gloomshrou [ Sat Oct 24, 2015 9:42 pm ]
Post subject:  ToME 2.3.5 - Crash on Save/Load

This topic has been written about several times (over the course of more than a decade), but I have yet to see any resolutions.

I am playing ToME 2.3.5 as found in the Software Manager of Linux Mint 17.2 "Rafaela." However, whenever I try to save, I crash to desktop. Anyone else have this problem and/or know how to fix it?

Author:  Lord Estraven [ Sun Oct 25, 2015 2:48 pm ]
Post subject:  Re: ToME 2.3.5 - Crash on Save/Load

My recommendation is to install cmake, git, build-essential, and xorg-dev, and then check out v.2.3.9-ah

Code:
git clone -b v2.3.9-ah https://gitlab.com/tome2/tome2.git


and compile

Code:
cd tome2
cmake .
nice make


Alternatively, if you want to stick with 2.3.5, you could install gdb and try to pinpoint the issue.

Code:
gdb /usr/bin/tome2
run -mx11


And then when you get a crash

Code:
bt


will get you a stack trace, showing which function it crashed in.

Good luck!

P.S. I bet this is Ubuntu's buffer overflow detection.

Edit: actually let me try to reproduce this...

Author:  Lord Estraven [ Sun Oct 25, 2015 3:08 pm ]
Post subject:  Re: ToME 2.3.5 - Crash on Save/Load

Yeah, this is Ubuntu's buffer overflow detection killing the program. You'll have to either upgrade to the tome2-ah versions, or fix the bug and recompile. Let me see if I can figure out where it's bugging out exactly.

Author:  Lord Estraven [ Sun Oct 25, 2015 3:12 pm ]
Post subject:  Re: ToME 2.3.5 - Crash on Save/Load

So, this is a bad strcpy call in do_subrace() in loadsave.c, line 240. I'm guessing the target buffer is too small, thus the buffer overflow detection.

Author:  Lord Estraven [ Sun Oct 25, 2015 3:22 pm ]
Post subject:  Re: ToME 2.3.5 - Crash on Save/Load

@Gloomshrou

The issue appears to be that the buffer is one character too short. do_string() applies a terminating NUL past the end of the buffer, which is caught by buffer overflow protection and crashes the program. Changing

Code:
static void do_subrace(int flag)
{
        player_race_mod *sr_ptr = &race_mod_info[SUBRACE_SAVE];
        int i;
        char buf[81];
...


to have

Code:
        char buf[82];


instead, fixes the crash... at least for now.

(But frankly I'm very distrustful of that I/O code in loadsave.c, and think you should upgrade to 2.3.9-ah anyway. :) )

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/