stransky / berusky2

Berusky 2 (Bugs Escape 3D) is a game that challenges your visual/spatial thinking and ability to find a way to resolve a logic task. Using five bugs, you'll go through an adventure full of various puzzles spread across nine episodes. Individual episodes differ in appearance and difficulty, which increases throughout the game.
http://anakreon.cz/en/Berusky2.htm
GNU General Public License v3.0
15 stars 3 forks source link

Specifying a wrong level name on the command line triggers an assertion #26

Closed apoleon closed 10 years ago

apoleon commented 10 years ago

Hi,

while I was testing the latest release, I found this bug.

$ berusky2 level6.lvl6

works as intended. The game loads map level6.

$ berusky2 level6

An error message is printed to STDERR

Loading level from /usr/share/games/berusky2/game ... Chyba na line 57 file komat/mmalloc.h Unable to allocate 1821204736 bytes berusky2: komat/Ddx.cpp:493: void tisknichybu(int, char, char_, ...): Assertion `0' failed. [1] 18735 abort berusky2 level6

stransky commented 10 years ago

Hm, I can't reproduce it. It prints:

Unable to load level 'level'...

and quits. Which version do you run?

apoleon commented 10 years ago

On 25.01.2014 18:44, Martin Stransky wrote:

Hm, I can't reproduce it. It prints:

Unable to load level 'level'...

and quits. Which version do you run?

I can reproduce it with the latest version, 0.10.

berusky2 level6

Loading level from /usr/share/games/berusky2/game ... Chyba na line 57 file komat/mmalloc.h Unable to allocate -1977360896 bytes berusky2: komat/Ddx.cpp:493: void tisknichybu(int, char, char_, ...): Assertion `0' failed. [1] 11606 abort berusky2 level6

Please note that I have compiled berusky2 as is. That means I didn't set -DNDEBUG.

Do you use -DNDEBUG when releasing for Fedora? Would it be better to set this flag for releases?

Markus

stransky commented 10 years ago

Hm, strange. Can you please attach a backtrace of the assert? I use a standard build flags, no extra modifications.

stransky commented 10 years ago

Anyway, berusky2 level6 works for me (loads level6.lv6) because of the auto completion. It may be a bug there.

apoleon commented 10 years ago

On 25.01.2014 19:09, Martin Stransky wrote:

Hm, strange. Can you please attach a backtrace of the assert? I use a standard build flags, no extra modifications.

Please find attached two gdb log files.

gdb_normal.txt is the gdb output when I run the current Debian binary for berusky2 0.10

gdb_O0.txt contains the log for a recompiled version with less optimization -O0 and with debugging symbols.

Strangely, when I run the recompiled version the game even starts but then segfaults with another error message...

0 0x00007ffff5aef1d5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56

    resultvar = 0
    pid = 3123
    selftid = 3123

1 0x00007ffff5af2388 in __GI_abort () at abort.c:90

    save_stage = 2
    act = {__sigaction_handler = {sa_handler = 0x7fffffffde47, sa_sigaction = 0x7fffffffde47}, sa_mask = {__val = {
          140737316529161, 5694031, 493, 2000, 140737315249229, 8687848, 24, 51539607552, 4, 140737488326560, 0, 
          0, 0, 140737316528531, 140737038217216, 140737316544640}}, sa_flags = 5640288, sa_restorer = 0x56e0a0}
    sigs = {__val = {32, 0 <repeats 15 times>}}

2 0x00007ffff5ae8252 in __assert_fail_base (fmt=0x7ffff5c26080 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",

assertion=assertion@entry=0x561060 "0", file=file@entry=0x56e24f "komat/Ddx.cpp", line=line@entry=493, 
function=function@entry=0x56e0a0 "void tiskni_chybu(int, char_, char_, ...)") at assert.c:92
    str = 0x7fffdc0008c0 ""
    total = 4096

3 0x00007ffff5ae8302 in __GI___assert_fail (assertion=0x561060 "0", file=0x56e24f "komat/Ddx.cpp", line=493,

function=0x56e0a0 "void tiskni_chybu(int, char_, char_, ...)") at assert.c:101

No locals.

4 0x0000000000520932 in ?? ()

No symbol table info available.

5 0x00000000004638c0 in ?? ()

No symbol table info available.

6 0x000000000045ae5f in ?? ()

No symbol table info available.

7 0x000000000045f8ff in ?? ()

No symbol table info available.

8 0x00000000004074ff in ?? ()

No symbol table info available.

9 0x00007ffff5adb995 in __libc_start_main (main=0x4072c0, argc=2, ubp_av=0x7fffffffdae8, init=,

fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdad8) at libc-start.c:276
    result = <optimized out>
    unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, 7811634706103631945, 4224922, 140737488345824, 0, 0, 
            -7811634707098271671, -7811657123494789047}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x55e7f0, 
          0x7fffffffdae8}, data = {prev = 0x0, cleanup = 0x0, canceltype = 5629936}}}
    not_first_call = <optimized out>

10 0x00000000004077c3 in ?? ()

No symbol table info available. A debugging session is active.

Inferior 1 [process 3123] will be killed.

Quit anyway? (y or n)

0 0x000000000048d77c in gl_Run_Level (p_Level_Name=0xb0ec68 <ber+1558248> "level6",

p_Env_Name=0x7fffffffb950 "default.env", p_ad=0x84c940 <ad>, iCPU=8304) at kofola/game_logic.cpp:11224
    rot = 0
    iKeyLine = {0, 0, 0}
    Frame_Rate_Counter = 13
    bBeetleAdded = 0 '\000'
    bVisibility = 1 '\001'
    pEnv = 0xb0e710 <ber+1556880>
    Return = 0
    _new = 0
    orientation = {0, 0.5, 0.866025388, 0, 0.866025388, -0.5}
    bHint = 0 '\000'
    no_Menu = 0 '\000'
    bCursor = 1 '\001'
    bLastSunuti = 0 '\000'
    iMenuAnimation = 0
    iRestart = 0
    bPause = 0 '\000'
    Cursor_Time_Out = 5
    act_item = -1
    cLevelName = "level6\000\000\331a\271\365\377\177\000\000\000\000\000\000\000\000\000\000\363\377\262\365\377\177\000\000\300\374\260\000\000\000\000\000\200\020\346\365\377\177\000\000\037\000\000\000\000\000\000\000\220\210\377\377\377\177\000"
    bCamera = 0 '\000'
    pos_n = {0, 0, 0}
    iReturn = {-1, 0}
    cDemoName = "[level6]_[Jan_25_2014]_[18_15_33].dem\000\000\000^\t\263\365\377\177\000\000\200\020\346\365\377\177\000\000\031\000\000\000\000\000\000\000\031\000\000\000\000\000\000\000\001", '\000' <repeats 15 times>, "\361_\260\365\377\177\000\000\300\301h\366\377\177\000\000\200\020\346\365\377\177", '\000' <repeats 17 times>
    NoKeyCounter = 0
    bmpc = 0
    **PRETTY_FUNCTION** = "int gl_Run_Level(char_, char_, AUDIO_DATA*, int)"
    iKeyCursor = 0
    GetCamera = {Position = {-0.20790717, 0.171607733, -0.378266752}, Target = {0, 0, 0}, Roll = 0, fi = 0, r = 0, 
      Distance = 0}
    bOvladaniBerusek1 = 1 '\001'
    bRestart = 0 '\000'
    cameraanim = 0

1 0x0000000000491b82 in winmain_Game_Run (p_Level_Name=0xb0ec68 <ber+1558248> "level6") at kofola/game_main.cpp:244

    cenv = "default.env", '\000' <repeats 52 times>
    dir = "data.pak\000k", '\000' <repeats 3830 times>...
    bitmap_pak = "bitmap.pak\000\365\377\177\000\000\000\000\000\000\000\000\000\000Y\004\263\365\377\177", '\000' <repeats 26 times>, " \362\331\000\v\000\000\000+\347Y\000\000\000\000\000\000\000\000\000\022\000\000\000\002\376\000\000\000\000\000\000\262U\002\000\000\000\000\000\001\000\000\000\000\000\000\000\244\201\000\000\v\000\000\000\350\003\000\000\000\000\000\000\000\000\000\000\023\000\000\000\345\031\000\000\000\000\000\000\000\020\000\000\000\000\000\000+\347Y\000\000\000\000\000\264\372\343R\000\000\000\000\270\200\222!\000\000\000\000\354\300\337R\000\000\000\000\360\365\346\017\000\000\000\000\354\300\337R\000\000\000\000\360\365\346\017", '\000' <repeats 28 times>...
    Timer_ID = 0x27cdb80
    cpu = 8304
    bGame = 6 '\006'

2 0x00000000004b1180 in main (argc=2, argv=0x7fffffffdae8) at komat/Berusky3d_ini.cpp:360

    p_age = 0xb38270
    p_grf = 0xb382c0
    p_scene = 0xdd4f70

A debugging session is active.

Inferior 1 [process 2652] will be killed.

Quit anyway? (y or n)

stransky commented 10 years ago

Yes, I can reproduce it now.

stransky commented 10 years ago

Fixed by b1f0897e14b41d4de583715ad06d9723a84dec80