Skip to content

Validate Cx4 command geometry against HLE RAM - #403

Open
acts-1631 wants to merge 1 commit into
bsnes-emu:masterfrom
acts-1631:fix/cx4-buffer-bounds
Open

acts-1631 wants to merge 1 commit into
bsnes-emu:masterfrom
acts-1631:fix/cx4-buffer-bounds

Conversation

@acts-1631

Copy link
Copy Markdown

Cx4::C4DoScaleRotate() used dimensions written by emulated software to calculate a clear size and direct indexes into the 3 KiB HLE RAM buffer without validating the resulting layout. A crafted Cx4 ROM could make op00_07 write beyond the global Cx4 object, potentially crashing or corrupting the emulator process.

Reject scale and rotate layouts that exceed Cx4 RAM, and validate the source and output ranges used by the related op00_0b disintegrate command. Stop op00_00 object table reads at the end of RAM and use wider intermediates for the affected coordinate calculations.

Cx4 scale and rotate commands trusted ROM-controlled dimensions when
clearing and rendering into the 3 KiB HLE RAM buffer. Large values could
overwrite memory beyond the global Cx4 object.

Reject layouts that exceed RAM, validate the disintegrate source and
output ranges, and stop object table reads at the end of Cx4 RAM. Use
wider intermediates for the related coordinate calculations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant