From e63e89e2704abf7b8515c20b0c8ada769b60ae6a Mon Sep 17 00:00:00 2001 From: Philipp AUER Date: Mon, 21 Jul 2025 19:33:44 +0200 Subject: [PATCH] Fix potential stack memory leak in gbagfx due to out of bounds read (#2162) * fix(tools): gbagfx potential oob read --------- Co-authored-by: sbird --- tools/gbagfx/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/gbagfx/main.c b/tools/gbagfx/main.c index 98a1a1edf9..497a869e14 100644 --- a/tools/gbagfx/main.c +++ b/tools/gbagfx/main.c @@ -333,6 +333,9 @@ void HandleJascToGbaPaletteCommand(char *inputPath, char *outputPath, int argc, if (numColors < 1) FATAL_ERROR("Number of colors must be positive.\n"); + + if (numColors > 255) + FATAL_ERROR("Number of colors must be less than 256.\n"); } else {