icculus / mojozork

A simple Z-Machine implementation in a single C file. Now with online multiplayer! :)
https://www.patreon.com/posts/54997062
zlib License
122 stars 12 forks source link

ERROR: parse buffer is too small for reading (mojozork.c) #24

Closed fletcher closed 10 months ago

fletcher commented 10 months ago

I apologize if this issue is out of scope for the project.

I attempted to play a couple of z3 games, and one of them was Moonmist (I tried both moonmist-r13-s880501.z3 and moonmist-r4-s860918.z3 from the Obsessively Complete Infocom Catalog.)

The following sequence leads to the parse buffer error:

push eye
Mr John Doe

I am still trying to understand the source code, but when I change the condition in line 1336 of mojozork.c to be if (parselen < 3) instead of if (parselen < 4), then these actions work correctly, and I can continue the game.

I am not sure what I may have broken by doing this. As a quick check, I ran ./mojozork zork1.dat zork1-script.txt and it successfully completed the game without any apparent errors. I realize this is not a comprehensive validation that I did not break something else here, since I assume that condition was placed for a purpose.

Is there a proper solution for this parsing error in Moonmist?

Thank you for your thoughts, as well as for this project!

icculus commented 10 months ago

This was my mistake, sorry about that! Should work now.

fletcher commented 10 months ago

Thanks for the quick fix!!