ZDoom / Raze

Build engine port backed by GZDoom tech. Currently supports Duke Nukem 3D, Blood, Shadow Warrior, Redneck Rampage and Powerslave/Exhumed.
697 stars 59 forks source link

[BUG] [SW] `SectIterator` crash in `$refiner.map` #218

Closed Talon1024 closed 3 years ago

Talon1024 commented 3 years ago

If you try to use the only vehicle in $refiner.map, the game will crash immediately upon trying to enter the vehicle.

I am on Linux 4.15.0, x86-64, Kubuntu 18.04

sinisterseed commented 3 years ago

That would be MAP14 Crude Oil, and this small tank:

ShadowWarrior_0000

This sounds like a Linux or distro issue to me. On Windows it works correctly.

coelckers commented 3 years ago

Since it's platform specific: need more info.

sinisterseed commented 3 years ago

Indeed, especially a crash or trace log would be nice to have, since the game crashes on your end.

Talon1024 commented 3 years ago

Here is the backtrace from GDB:

raze: /home/kevinc/Games/code/Raze/source/core/iterators.h:51: SectIterator::SectIterator(int): Assertion `stat >= 0 && stat < MAXSECTORS' failed.                          

Thread 1 "raze" received signal SIGABRT, Aborted.                                     
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51                 
51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.                
(gdb) bt                                                                              
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51             
#1  0x00007ffff5754921 in __GI_abort () at abort.c:79                                 
#2  0x00007ffff574448a in __assert_fail_base (                                        
    fmt=0x7ffff58cb750 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",                   
    assertion=assertion@entry=0x55555628abc0 "stat >= 0 && stat < MAXSECTORS",        
    file=file@entry=0x55555628ab88 "/home/kevinc/Games/code/Raze/source/core/iterators.h", line=line@entry=51,                                                              
    function=function@entry=0x55555628adc0 <SectIterator::SectIterator(int)::__PRETTY_FUNCTION__> "SectIterator::SectIterator(int)") at assert.c:92                         
#3  0x00007ffff5744502 in __GI___assert_fail (                                        
    assertion=0x55555628abc0 "stat >= 0 && stat < MAXSECTORS",                        
    file=0x55555628ab88 "/home/kevinc/Games/code/Raze/source/core/iterators.h",       
    line=51,                                                                          
    function=0x55555628adc0 <SectIterator::SectIterator(int)::__PRETTY_FUNCTION__> "SectIterator::SectIterator(int)") at assert.c:101                                       
#4  0x0000555555a8b60b in SectIterator::SectIterator (this=0x7fffffffc8a0, stat=-1)   
    at /home/kevinc/Games/code/Raze/source/core/iterators.h:51                        
#5  0x00005555561447cc in ShadowWarrior::DriveCrush (                                 
    pp=0x55555793e5a0 <ShadowWarrior::Player>, x=0x7fffffffc9b0, y=0x7fffffffc9c0)
    at /home/kevinc/Games/code/Raze/source/sw/src/player.cpp:2642
#6  0x00005555561456e6 in ShadowWarrior::DoPlayerMoveVehicle (
    pp=0x55555793e5a0 <ShadowWarrior::Player>)
    at /home/kevinc/Games/code/Raze/source/sw/src/player.cpp:2897
#7  0x000055555614d081 in ShadowWarrior::DoPlayerOperateVehicle (
    pp=0x55555793e5a0 <ShadowWarrior::Player>)
    at /home/kevinc/Games/code/Raze/source/sw/src/player.cpp:5659
#8  0x000055555615102e in ShadowWarrior::domovethings ()
    at /home/kevinc/Games/code/Raze/source/sw/src/player.cpp:7235
#9  0x00005555561250af in ShadowWarrior::GameInterface::Ticker (this=0x555557b6f900)
    at /home/kevinc/Games/code/Raze/source/sw/src/game.cpp:666
#10 0x0000555555adac8d in GameTicker ()
    at /home/kevinc/Games/code/Raze/source/core/mainloop.cpp:321
---Type <return> to continue, or q <return> to quit---
#11 0x0000555555adb4db in TryRunTics ()
    at /home/kevinc/Games/code/Raze/source/core/mainloop.cpp:600
#12 0x0000555555adb59c in MainLoop ()
    at /home/kevinc/Games/code/Raze/source/core/mainloop.cpp:644
#13 0x0000555555ae2048 in RunGame ()
    at /home/kevinc/Games/code/Raze/source/core/gamecontrol.cpp:935
#14 0x0000555555ae0a92 in GameMain ()
    at /home/kevinc/Games/code/Raze/source/core/gamecontrol.cpp:537
#15 0x0000555555929fda in main (argc=1, argv=0x7fffffffde18)
    at /home/kevinc/Games/code/Raze/source/common/platform/posix/sdl/i_main.cpp:148
Talon1024 commented 3 years ago

Are you sure it's supposed to access an element of StatDamageList on https://github.com/coelckers/Raze/blob/master/source/sw/src/player.cpp#L2642? That doesn't make sense to me. I think the game is trying to access a value which is out of bounds of StatDamageList. On my system, that value is apparently -1. And BTW, this is the commit in which that line was changed.

coelckers commented 3 years ago

Yes, that line is definitely not correct. It was a copy/paste error but I thought I had removed them all. Apparently this line was missed.