ToME Crashes Randomly

Bug #368127 reported by Adam Portier
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
tome (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: tome

When playing Troubles of Middle Earth in both console and graphical mode, I experience random crashes. The console displays many lines of output about errors against shared-object libraries. I am trying to capture this and post it once I have one. This behavior did not occur when I was using this package in Intrepid.

Edit -
Here is an example of the error output. There is a lot more, but scrollback doesn't pick it up. Simply piping the output to a file does not copy this error out, possibly an ncurses thing?

/usr/lib/libXext.so.6.4.0
                                                                 b7be5000-b7be6000 r--p 0000d000 08:01 360589 /usr/lib/libXext.so.6.4.0
                                                           b7be6000-b7be7000 rw-p 0000e000 08:01 360589 /usr/lib/libXext.so.6.4.0
                                                     b7be7000-b7be8000 rw-p b7be7000 00:00 0
             b7be8000-b7c0c000 r-xp 00000000 08:01 2425653 /lib/tls/i686/cmov/libm-2.9.so
            b7c0c000-b7c0d000 r--p 00023000 08:01 2425653 /lib/tls/i686/cmov/libm-2.9.so
           b7c0d000-b7c0e000 rw-p 00024000 08:01 2425653 /lib/tls/i686/cmov/libm-2.9.so
          b7c0e000-b7d6a000 r-xp 00000000 08:01 2425649 /lib/tls/i686/cmov/libc-2.9.so
         b7d6a000-b7d6b000 ---p 0015c000 08:01 2425649 /lib/tls/i686/cmov/libc-2.9.so
        b7d6b000-b7d6d000 r--p 0015c000 08:01 2425649 /lib/tls/i686/cmov/libc-2.9.so
       b7d6d000-bAborted

Ubuntu 9.04
tome 2.3.5-2

Tags: patch
Adam Portier (aportier)
description: updated
Revision history for this message
Steven Black (yam655) wrote :

I ran across this bug report when I was experiencing a very similar problem -- one which I think Adam may be experiencing.

Adam, is it really crashing randomly, or does it reliably crash when you try to save the game? When it crashed via saving the game, it will likely leave a save-file around which will also crash if you try to load it. If that's the problem you're encountering, then it is the same problem I've been having.

That problem has been reported upstream, and upstream has a patch:
http://wiki.t-o-m-e.net/BugReport930

I can confirm that after applying the patch on that page, I can save new games. The old partially-saved games (from earlier attempts to save the game) are a total waste and need to be removed. The way to check (and remove the crap that won't load) is simple: If the game saved properly, it should show up in the list of saved games (on the "New Character"/"Load Character" screen).

The saved files are placed in "~/.tome/2.3/save/". The bogus files show up in pairs, like: PLAYER.new PLAYER.pnc -- PLAYER (the default save file name) isn't usable until these two files are removed. Proper save files will have no extension (just PLAYER) with an additional user.$UID.svg descriptor file (appears to be one-line per save file, or per character -- I'm not sure. $UID is my system user-id).

I'd love to see this patch rolled in, as the game is extremely frustrating without it. A new player starts a new game, has a great time. tries to save the game, and *poof* -- the game is lost.

As the URL says, this bug is more visible on Ubuntu systems due to the use of Fortify. This particular bug wouldn't cause memory corruption until the user saves and that usually happens at application termination -- it is quite possible that folks not using Fortify would have never noticed the bug. The upstream folks are also working on 3.0. We need this patch.

Revision history for this message
Adam Portier (aportier) wrote :

I think you may have nailed the problem exactly. I turn on the "save after x turns" feature because I am paranoid. Perhaps the crashing wasn't as random as I thought, but was occurring after I had played a little and tried to save. I was assuming that the save file that was produced was corrupt because it would crash my game 100% of the time if I tried to load it again. I ended up regressing my copy to the version packaged with Intrepid, which works just fine for me (for the time being). I can not use the version rolled into Jaunty for exactly the reason stated above.

Changed in tome (Ubuntu):
status: New → Confirmed
Revision history for this message
Daniel Kessler (hornord) wrote :

I've run into the exact same bug, with Tome-2.3.5, as distributed in Ubuntu Lucid. Now a very bad thing is that the workaround proposed by Steven Black on 2009-08-04 is not possible anymore, because the link on his post is no longer valid... Does this patch still exist anywhere else? Ideally it should be applied to the distributed version for Ubuntu, so that new players don't run into this known bug, which really is a game-breaker.

Revision history for this message
Steven Black (blacks-indiana) wrote :

It looks like wiki.t-o-m-e.net is currently off-line.

Worst case this patch should be easy to recreate.

There's a buffer overflow in the save-game logic. Since it only happened saving the game, and most folks save the game before they quit, folks never noticed the buffer overflow... until Valgrind became the default with Ubuntu.

If you build the code from source (with debugging symbols) and run gdb on it it should point you to the source of the error. To reproduce the problem all you need to do is create a new game and try to immediately save it.

I've had some issues with some of my hardware since I commented on this ticket and I'm fairly certain I no longer have the original patch on any of my systems.

This should be a straight-forward process, so I'm going to try it myself and whip up a patch.

Revision history for this message
Steven Black (blacks-indiana) wrote :

Okay. I'm not sure how similar this is to the original patch, but the following three line patch takes care of the issue.

There may be some other consequence of this. I didn't increase the buffer so it is getting truncated, but I don't see it.

I'm just using strncpy instead of strcpy to make sure we don't write too much. I also explicitly set the last character of the array to be a NUL byte so it remains terminated even if it hits the limit.

It worked with my test on Ubuntu 10.04, but it was a fairly quick test.

Again, this fixes total breakage of this package in Ubuntu so this patch, the original patch, or a similar patch should be rolled in. The game is frustratingly unusable without a fix for this bug.

Revision history for this message
Daniel Kessler (hornord) wrote :

I applied the above patch to a fresh source found here: http://www.t-o-m-e.net/download.php?tome_current=0
It worked like a charm! I just needed to edit a makefile to point to the adequate X11 directories.
So thanks a lot for this patch, and I hope it does get rolled in for the benefit of future users.

tags: added: patch
Revision history for this message
Daniel Kessler (hornord) wrote :

I found that the bug happens to be fixed in the latest bug-fix release from the present maintainer of the 2.3.x branch of ToME. His latest source can be found here: http://gitorious.org/tome2/tome2 and the policy for these maintainance releases is explained here: http://forum.t-o-m-e.net/viewtopic.php?f=1&t=21344 This source is particularly Ubuntu-friendly in compilation (using cmake, read building.txt that contains an Ubuntu section).
There's also a thread on the ToME game forumj about a couple of remaining (non-gamebreaking) isues under Linux here: http://forum.t-o-m-e.net/viewtopic.php?f=1&t=22107

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

fixed in utopic

Changed in tome (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.