noxworld-dev / opennox

OpenNox main repository.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

al0fdf opened this issue · comments

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):

  • Get to village of Ix
  • Buy apples and cider from shopkeeper located north in Village(top of screen as north)
  • Get apple from small orchard in south of village
  • Run through urchin den, skipping most of the chests
  • Get to Aldwyn and buy charm creature spell from him
  • Run through sewer/passage back to Ix
  • Realise I don't have enough gold for poison spell, and go back to urchin den to raid some chests
  • Buy poison book from Mystic(hooded shopkeeper)

The crash(reproduced with 727ad22):

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 #301, so the autosave was not made by a clean build of the engine.

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

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