Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TINSEL: numPolygons fixes for big-endian systems #2995

Merged
merged 2 commits into from May 1, 2021

Conversation

@dwatteau
Copy link
Contributor

@dwatteau dwatteau commented May 1, 2021

When testing the original V0 Floppy Demo of Disworld (dw-dos-floppy-demo-en.zip) on a big-endian PowerPC machine, the game would immediately trigger assert(numPolys <= MAX_POLY) in MaxPolygons().

It appears that numPolygons was left uninitialized, and so it was set to a big value which would trigger this assertion.

Looking at the changes done in commit 24b77f1, I think the original intent was to use the (cptr != NULL) ? READ_32(cptr) : 0 idiom, like the rest around it.

Tested with the various available Discworld1 demos on a big-endian system.

dwatteau added 2 commits May 1, 2021
…mo V0

numPolygons was left uninitialized for the original V0 demo, so it could be
set to a big value which would trigger assert(numPolys <= MAX_POLY) in
MaxPolygons() and immediately crash the game.

This restores the implicit behavior before commit 24b77f1.
@bluegr
Copy link
Member

@bluegr bluegr commented May 1, 2021

Thanks for this, MaxPolygons was indeed not initialized in this case. Merging

@bluegr bluegr merged commit e60e0b8 into scummvm:master May 1, 2021
3 checks passed
3 checks passed
@codacy-production
Codacy Static Code Analysis Codacy Static Code Analysis
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@deepcode-ci-bot
deepcode-ci-bot Well done, no issues found!
Details
@dwatteau dwatteau deleted the dwatteau:fix/tinsel-v0-demo-on-ppc branch May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants