Opened 8 years ago
Closed 8 years ago
#9727 closed defect (fixed)
SCI: KQ4: Crash during intro
Reported by: | Kurufinwe21 | Owned by: | csnover |
---|---|---|---|
Priority: | normal | Component: | Engine: SCI |
Version: | Keywords: | ||
Cc: | Game: | King's Quest 4 |
Description
KQ4 crashes during the intro, after the credits (before going to the Castle Daventry throne room).
The error message is:
Access violation seeking sound.104: 4749 + 1 > 4749 (abs: 4782 + 1 > 4782)!
It happens regardless of the music device selected (AdLib or MT-32).
ScummVM version: 1.10.0git3031-g910e6816ea (win32 daily build from the ScummVM website) running on Windows 10 (64 bit).
N.B.: The bug does not occur with the latest release (1.9.0.2).
Game version: KQ4 SCI DOS English (from the RW Anthology).
Change History (2)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in 4946f149b40ca421e7da6cad64ffbbf1b37744e3. Thanks for the report!
This is the relevant part of the call stack for this crash:
The affected sound resource contains two MIDI Stop (0xFC) system commands, instead of just one (normally they only have one). When there is more data after the Stop command, as in sound 104, the filter loop continues to run. This causes an unconditional read of 2 bytes, where
curDelta
becomes 0xFC (the second Stop command), and trying to readcurByte
now raises an access violation as it is an out-of-bounds read.I think the correct solution is to just break out of the filter loop when an 0xFC command is seen, but I want to double-check with someone else with more MIDI knowledge before doing that (since I don’t know for sure that such commands cannot validly show up in the middle of a sound resource).