Skip to content

Conversation

SBird1337
Copy link
Collaborator

gbagfx parses the -num_colors cli argument and accepts values greater than the maximum amount of colors stored in a struct Palette (256) leading to an out of bounds read if high values are passed to gbagfx.

Description

Example behavior:

$ tools/gbagfx/gbagfx graphics/pokemon/abra/normal.pal normal.gbapal -num_colors 100000
fish: Job 1, 'tools/gbagfx/gbagfx graphics/po…' terminated by signal SIGSEGV (Address boundary error)

Fix:

$ tools/gbagfx/gbagfx graphics/pokemon/abra/normal.pal normal.gbapal -num_colors 100000
Number of colors must be less than 256.

Discord contact info

karathan

@mrgriffin mrgriffin merged commit e63e89e into pret:master Jul 21, 2025
1 check passed
ShinyDragonHunter pushed a commit to ShinyDragonHunter/pokeemerald that referenced this pull request Jul 31, 2025
…ret#2162)

* fix(tools): gbagfx potential oob read

---------

Co-authored-by: sbird <[email protected]>
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.

2 participants