Segmentation Fault in Wartool

Bug #998584 reported by EliCoten on 2012-05-13
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Wargus
Fix Released
Undecided
Pali

Bug Description

Whilst trying to install/configure wargus, during extraction of the data from the CD, wartools crashes. I have tried this twice now and the same thing happens.
Archive "~/WAR2/DATA/sfxdat.sud"
Archive "~/WAR2/DATA/rezdat.war"
Archive "~/WAR2/DATA/snddat.war"
Archive "~/WAR2/DATA/muddat.cud"
Segmentation fault (core dumped)
dpkg: error processing wargus (--configure):
 subprocess installed post-installation script returned error exit status 139
Errors were encountered while processing:
 wargus

If I try to run wargus anyway, I get the attached log. I'm trying to install the latest version 2.2.6

Related branches

EliCoten (launchpad-elicoten) wrote :
description: updated
Pali (pali) wrote :

wartool (data extractor) crashed, so data were not extracted and wargus cannot start. please run wartool manually and attach gdb backtrace.

$ gdb -ex r -ex bt --args wartool -m -v -r /path/to/war2cd /path/to/extract

Changed in wargus:
status: New → Incomplete
EliCoten (launchpad-elicoten) wrote :

Archive "DATA/snddat.war"
Archive "DATA/muddat.cud"

Program received signal SIGSEGV, Segmentation fault.
0x002f3656 in ?? () from /lib/i386-linux-gnu/libc.so.6
#0 0x002f3656 in ?? () from /lib/i386-linux-gnu/libc.so.6
#1 0xbfffee38 in ?? ()
#2 0x0028f4d3 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
#3 0x0804b0ad in _start ()
(gdb)

I assume I just type quit at this point

Joris Dauphin (joris-dauphin) wrote :

Which is your version/language of warcraft2 ?

EliCoten (launchpad-elicoten) wrote :

English UK DOS/Win95 CD version.

Pali (pali) wrote :

EliCoten, download source code of Wargus, compile it with debug symbols and run your compiled version. Binary version in PPA repository has stripped debug symbols, so backtrace from PPA version is useless.

Install build dependences:
$ sudo apt-get build-dep wargus

Download source code of Ubuntu version:
$ apt-get source wargus

Go to unpacked directory and compile debug version:
$ mkdir build && cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/ ..
$ make

Run compiled wartool in gdb and send backtrace of crash
$ gdb -ex r -ex bt --args ./wartool -m -v -r /path/to/war2cd /path/to/extract

EliCoten (launchpad-elicoten) wrote :

I downloaded the source and compiled the debug version according to your instructions.

This is what happened when running it through gdb:

Archive "~/WAR2/DATA/muddat.cud"

Program received signal SIGSEGV, Segmentation fault.
0x002f3656 in ?? () from /lib/i386-linux-gnu/libc.so.6
#0 0x002f3656 in ?? () from /lib/i386-linux-gnu/libc.so.6
#1 0x00000000 in ?? ()
(gdb)

Again I assume I just type quit?

Miguel Mendes Ruiz (migmruiz) wrote :

same error with UK version

(...)

Archive "/path/to/WAR2cd/data/snddat.war"
Archive "/path/to/WAR2cd/data/muddat.cud"
Segmentation fault (core dumped)

Pali (pali) wrote :

I used last wartool version from bzr and warcraft data from Miguel. Wartool did not crached on both 32 and 64 bit Ubuntu 12.04 systems. Output from valgrind did not show any errors:

$ valgrind --leak-check=full --show-reachable=yes ./wartool ../war2/data unpack
==14180== Memcheck, a memory error detector
==14180== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==14180== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==14180== Command: ./wartool ../war2/data unpack
==14180==
Note: Data is already extracted in Dir "unpack" with this version of wartool
Detected UK/Australian original DOS CD
Extract from "../war2/data" to "unpack"
Please be patient, the data may take a couple of minutes to extract...
Archive "../war2/data/rezdat.war"
Archive "../war2/data/strdat.war"
Archive "../war2/data/maindat.war"
Archive "../war2/data/sfxdat.sud"
Archive "../war2/data/rezdat.war"
Archive "../war2/data/snddat.war"
Archive "../war2/data/muddat.cud"
Done.
==14180==
==14180== HEAP SUMMARY:
==14180== in use at exit: 0 bytes in 0 blocks
==14180== total heap usage: 15,157 allocs, 15,157 frees, 427,965,094 bytes allocated
==14180==
==14180== All heap blocks were freed -- no leaks are possible
==14180==
==14180== For counts of detected and suppressed errors, rerun with: -v
==14180== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

Pali (pali) wrote :

@EliCoten, Miguel
Please use last version from bzr trunk for testing. Install package libc6-dbg (which provide debug sysmbols for libc):
$ sudo apt-get install libc6-dbg
and follow steps in comment #6

Miguel Mendes Ruiz (migmruiz) wrote :

I used the PPA version then, wargus version 2.2.6-2ubuntu1~precise. I'll try the bzr version soon.
I'll keep in touch.

Miguel Mendes Ruiz (migmruiz) wrote :

running
wartool path/to/war2cd ${CMAKE_INSTALL_PREFIX}/share/games/stratagus/wargus
as you did does unpack files correctly and the game runs normally without sound or video
works for both bzr and PPA versions

but doing
wartool -m -v -r /path/to/war2cd ${CMAKE_INSTALL_PREFIX}/share/games/stratagus/wargus
as the default installer does and the README file instruct us leads to Segmentation fault as before
for both bzr and PPA versions as well

runnig
wartool path/to/war2cd ${CMAKE_INSTALL_PREFIX}/share/games/stratagus/wargus
and then
wartool -m -v -r /path/to/war2cd ${CMAKE_INSTALL_PREFIX}/share/games/stratagus/wargus
causes crashes during runtime

Pali (pali) wrote :

Miguel, install package libc6-dbg, compile wargus in debug mode and run wartool under gdb. Then attach backtrace of Segmentation fault.

Pali (pali) wrote :

Now I found problem. If some archives are incomplete or corrupted wartool crash. There is some tool which delete videos from archive muddat.cud. It was used to decrease warcraft II size in 90's years. Wartool crashed if tried to unpack these "patched" archives.

I created patch which check entires in archives and then mark corrupted or incomplete entries as empty (use some static 32bit memory). That fixed problem on my computer.

I tested extraction (videos + music) in valgrind and everthing was ok.

Patch was commited to bzr trunk: https://bazaar.launchpad.net/~stratagus/wargus/trunk/revision/1664

Changed in wargus:
status: Incomplete → Fix Committed
assignee: nobody → Pali (pali)
milestone: none → 2.2.7
summary: - Segmentation Fault in Wartools
+ Segmentation Fault in Wartool
Miguel Mendes Ruiz (migmruiz) wrote :

doing
wartool -m -v -r /path/to/war2cd ${CMAKE_INSTALL_PREFIX}/share/games/stratagus/wargus
runs to the end ignoring those incomplete entries, no Segmentation Fault, ok.
but wargus won't run after that

besides
wartool path/to/war2cd ${CMAKE_INSTALL_PREFIX}/share/games/stratagus/wargus
witch worked without warning then now ignores those incomplete entries and wargus won't run either, not even without sound

$ wargus
[string "/usr/share/games/stratagus/wargus/scripts/s..."]:211: attempt to call global 'DefineDefaultResourceMaxAmounts' (a nil value)
stack traceback:
 [string "/usr/share/games/stratagus/wargus/scripts/s..."]:211: in main chunk

is this expected?

thanks for the patch anyway!

cybermind (iddqd-mail) wrote :

Install new stratagus from trunk

Miguel Mendes Ruiz (migmruiz) wrote :

now I get

$ wargus
[string "/usr/share/games/stratagus/wargus/scripts/s..."]:348: bad argument #1 to 'SetMouseScrollSpeed' (number expected, got nil)
stack traceback:
 [C]: in function 'SetMouseScrollSpeed'
 [string "/usr/share/games/stratagus/wargus/scripts/s..."]:348: in main chunk

Miguel Mendes Ruiz (migmruiz) wrote :

after compiling and installing stratagus from trunk, I forgot to mention

Miguel Mendes Ruiz (migmruiz) wrote :

ok, that was easy:
just removed my personal preferences file preferences.lua under ~/.stratagus/wc2 and everything was then properly setup

now it extracts the data from my CD without failing and plays like a charm after that
thanks!

Pali (pali) wrote :

Wartool now writes that ignoring some entries with correct/original CD. I checked these ignored entries and none of them is needed for wargus. So it is wartool crash prevention.

Also when you upgrading to new wargus version (from trunk), make sure that you have also updated stratagus and cleaned preferences.

Pali (pali) on 2012-08-20
Changed in wargus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments