Opened 8 months ago

Closed 8 months ago

#14646 closed defect (fixed)

SCI: QFG4: Game crashes if Import character button is clicked without a file selected

Reported by: KGOrphanides Owned by: sluicebox
Priority: normal Component: Engine: SCI
Version: Keywords: QFG4, import
Cc: KGOrphanides Game: Quest for Glory 4

Description

Very trivial bug here. Clicking Import on the Import Character screen if there is no file to import crashes the game.

Steps to reproduce:
Ensure that no QFG .sav character file is located in the ScummVM save path (usually ~\.scummvm)
Launch GOG version of Quest for Glory 4 (CD/DOS/English)
Click Import Character

Result:
The ScummVM console pops up with
`ERROR:
parameter 0: 000f:0007 (reference), should be reference
parameter 1: 0000:0002 (integer), should be null, integer
parameter 2: 0000:0000 (null, integer), should be reference
parameter 3: 0000:0000 (null, integer), should be null, integer
parameter 4: 0000:0001 (integer), should be null, integer
[VM] KArrayCopy: signature mismatch in method Str::callKernel (room 54, script 64918, localCal

)

Reproducibility:
I've reproduced the issue under version 2.7.0 (Pop!_OS 22.04) on x64 and 2.7.1 build from source on aarch64 (Raspberry Pi OS 6.1). If you have a file in the path, you just get the expected "sorry I couldn't find your character" message.

Attachments (1)

image-20230925-151147.png (40.9 KB ) - added by KGOrphanides 8 months ago.

Download all attachments as: .zip

Change History (3)

by KGOrphanides, 8 months ago

Attachment: image-20230925-151147.png added

comment:1 by sluicebox, 8 months ago

Component: GUIEngine: SCI
Game: Quest for Glory 4
Summary: QFG4: Game crashes if Import character button is clicked without a file selected (Linux)SCI: QFG4: Game crashes if Import character button is clicked without a file selected

Hello! Thank you for reporting this.

I took a quick look, I understand why it's throwing that error but I don't understand why the original doesn't. (yet!)

I also tried disabling our code that hooks into this dialog to display our message box and disable the Change Directory button, and that doesn't seem to affect this.

I'll try modding QFG4 scripts later to narrow down the discrepancy in the original

This error happens on all platforms.

comment:2 by sluicebox, 8 months ago

Owner: set to sluicebox
Resolution: fixed
Status: newclosed

Fixed in: https://github.com/scummvm/scummvm/commit/2a9439182a1a06c9400689be395af14c4f6e42a3

This *should* have been a fatal error in Sierra's interpreter, in which case someone would have noticed it and fixed the game script, but according to the disassembly, the interpreter's validation tested the address that held the null pointer instead of the null pointer itself, so the validation always passed. Classic QFG4! =)

I've updated our validation to match what really happens.

Thanks again!

Note: See TracTickets for help on using tickets.