Harden Amiga CF2 sprite loading against palette and RAW OOB access#121
Closed
segrax wants to merge 1 commit into
Closed
Harden Amiga CF2 sprite loading against palette and RAW OOB access#121segrax wants to merge 1 commit into
segrax wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
.PALand.RAWassets into legacy helpers that assumed well-formed inputs, allowing oversized palette data to write past a fixed 256-entry palette and undersized RAWs to trigger out-of-bounds reads/crashes during sprite drawing.Description
sImage::LoadPalette_Amiga()writes to the fixed 256-entry palette by bounding the number of colors read and early-returning whenpStartColorIDis out of range, preventing out-of-bounds palette writes; changed inSource/Graphics.hpp(LoadPalette_Amiga)..RAWbuffer size incGraphics_Amiga2::GetImage()and reject undersized decoded images before they are used, preventing downstream reads from truncated image buffers; changed inSource/Amiga/Graphics_Amiga2.cpp(GetImage).cGraphics_Amiga2::Map_Load_Resources()add a size check for the loaded sprite sheets and drop invalid sheets to avoid later sprite-drawing OOB accesses; changed inSource/Amiga/Graphics_Amiga2.cpp(Map_Load_Resources).Testing
cmake -S . -B build && cmake --build build -j2, but configuration fails in this environment due to a missing SDL3 development package (SDL3Config.cmake/sdl3-config.cmake), so an end-to-end build could not be completed.Codex Task