From d243e5039077c44cb9c813e4e63166b36932259c Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Fri, 8 Jul 2022 19:22:12 +0200 Subject: [PATCH] Do not perform any sanity checks for bad section types Otherwise, the arrays get overflowed --- src/link/section.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/link/section.c b/src/link/section.c index f32cab26..86598030 100644 --- a/src/link/section.c +++ b/src/link/section.c @@ -220,8 +220,11 @@ static void doSanityChecks(struct Section *section, void *ptr) /* Sanity check the section's type */ - if (section->type < 0 || section->type >= SECTTYPE_INVALID) + if (section->type < 0 || section->type >= SECTTYPE_INVALID) { fail("Section \"%s\" has an invalid type.", section->name); + return; + } + if (is32kMode && section->type == SECTTYPE_ROMX) { if (section->isBankFixed && section->bank != 1) fail("%s: ROMX sections must be in bank 1 (if any) with option -t",