shithub: rgbds

Download patch

ref: d243e5039077c44cb9c813e4e63166b36932259c
parent: acb33777c6110e2685f812675586e04dcd34f0e6
author: ISSOtm <eldredhabert0@gmail.com>
date: Fri Jul 8 15:22:12 EDT 2022

Do not perform any sanity checks for bad section types

Otherwise, the arrays get overflowed

--- a/src/link/section.c
+++ b/src/link/section.c
@@ -220,8 +220,11 @@
 
 	/* 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",