noxworld-dev / opennox

OpenNox main repository.
GNU General Public License v3.0
440 stars 23 forks source link

`panic: index out of range` in Village of Ix #681

Open al0fdf opened 4 months ago

al0fdf commented 4 months ago

When starting a solo conjurer campaign, I managed to create an autosave file that crashes after waiting for about 15 seconds. Recount of game so far(if relevant):

The crash(reproduced with 727ad22ae):

2024/03/01 19:10:03 [audio]: ADPCM stream: "music/town1.wav", 2 channels
panic: runtime error: index out of range [253] with length 89 [recovered]
    panic: runtime error: index out of range [253] with length 89

goroutine 1 [running, locked to thread]:
github.com/noxworld-dev/opennox/v1.RunArgs.func1()
    /home/user/programs/nox/src/main.go:96 +0x9b
panic({0x8efbc60, 0xbe2d150})
    /usr/lib/go/src/runtime/panic.go:920 +0x24c
github.com/noxworld-dev/opennox/v1/legacy/client/audio/ail.decodeNibble(0xe343, 0x0, 0xfd)
    /home/user/programs/nox/src/legacy/client/audio/ail/audio_openal.go:308 +0xbf
github.com/noxworld-dev/opennox/v1/legacy/client/audio/ail.decodeADPCMStereo({0x11080000, 0x0, 0xc000}, {0xe6e3aa8, 0x400, 0xc000})
    /home/user/programs/nox/src/legacy/client/audio/ail/audio_openal.go:354 +0x1f0
github.com/noxworld-dev/opennox/v1/legacy/client/audio/ail.(*audioStream).adpcmDecode(0xe6e2000, {0x11080000, 0xc000, 0xc000}, 0x2274)
    /home/user/programs/nox/src/legacy/client/audio/ail/audio_openal.go:483 +0x141
github.com/noxworld-dev/opennox/v1/legacy/client/audio/ail.(*audioStream).decode(0xe6e2000, {0x11080000, 0xc000, 0xc000}, 0x2274)
    /home/user/programs/nox/src/legacy/client/audio/ail/audio_openal.go:405 +0x8f
github.com/noxworld-dev/opennox/v1/legacy/client/audio/ail.(*audioStream).work(0xe6e2000)
    /home/user/programs/nox/src/legacy/client/audio/ail/audio_openal.go:1436 +0x22a
github.com/noxworld-dev/opennox/v1/legacy/client/audio/ail.(*audioDriver).doWork(0xb21a120)
    /home/user/programs/nox/src/legacy/client/audio/ail/audio_openal.go:1479 +0xa0
github.com/noxworld-dev/opennox/v1/legacy/client/audio/ail.Serve()
    /home/user/programs/nox/src/legacy/client/audio/ail/audio_openal.go:1060 +0x138
github.com/noxworld-dev/opennox/v1.(*Client).sub4312C0(0xb3f0000)
    /home/user/programs/nox/src/client.go:170 +0x2c
github.com/noxworld-dev/opennox/v1.(*Client).Update(0xb3f0000)
    /home/user/programs/nox/src/client.go:158 +0x237
github.com/noxworld-dev/opennox/v1.mainloop_43E290(0x1)
    /home/user/programs/nox/src/gameloop.go:161 +0x543
github.com/noxworld-dev/opennox/v1.mainloop_43E290(0x0)
    /home/user/programs/nox/src/gameloop.go:186 +0x743
github.com/noxworld-dev/opennox/v1.cmainLoop()
    /home/user/programs/nox/src/gameloop.go:354 +0x13e
github.com/noxworld-dev/opennox/v1.RunArgs({0xa93c018, 0x3, 0x3})
    /home/user/programs/nox/src/main.go:461 +0x2c17
main.main()
    cmd/opennox/main.go:12 +0x3b

The autosave: IX_CONJURER_AUTOSAVE_BROKEN.zip

This was done while I was trying to fix https://github.com/noxworld-dev/opennox/issues/301, so the autosave was not made by a clean build of the engine.

dennwc commented 4 months ago

Not sure why it finds a bad audio stream, but it definitely shouldn't crash the engine. Will fix that.

angrykirc commented 4 months ago

Did not crash the game for me @ 48ebb887, maybe you have something wrong with the game files? Anyways, agree that it shouldn't crash the game