From 5bc8ff98de9e7d942b7920645ce1a162d93af3ab Mon Sep 17 00:00:00 2001 From: bbbradsmith Date: Sun, 19 Feb 2023 09:01:17 -0500 Subject: [PATCH 1/2] error if computed memory size is negative --- src/ld65/config.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ld65/config.c b/src/ld65/config.c index c22ced1ef..6606df7e3 100644 --- a/src/ld65/config.c +++ b/src/ld65/config.c @@ -1936,6 +1936,11 @@ unsigned CfgProcess (void) GetString (M->Name)); } M->Size = GetExprVal (M->SizeExpr); + if (M->Size >= 0x80000000) { + CfgError (GetSourcePos (M->LI), + "Size of memory area '%s' is negative: %ld", + GetString (M->Name), (long)M->Size); + } /* Walk through the segments in this memory area */ for (J = 0; J < CollCount (&M->SegList); ++J) { From 3df5b9f41faabcbff982713db485d91cc8ac9a6c Mon Sep 17 00:00:00 2001 From: bbbradsmith Date: Sun, 19 Feb 2023 09:30:07 -0500 Subject: [PATCH 2/2] relocate dasm test start-addr to avoid producing negative memory area size with none.cfg (conflicted with stack position at $8000) --- test/dasm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dasm/Makefile b/test/dasm/Makefile index d9ac7ac21..e84560ad2 100644 --- a/test/dasm/Makefile +++ b/test/dasm/Makefile @@ -30,7 +30,7 @@ ISEQUAL = ../../testwrk/isequal$(EXE) CC = gcc CFLAGS = -O2 -START = --start-addr 0x8000 +START = --start-addr 0x7000 .PHONY: all clean