From 39ef63cbbc0f27968fdd044a0af22630969324e6 Mon Sep 17 00:00:00 2001 From: Greg King Date: Fri, 4 Jun 2021 08:49:10 -0400 Subject: [PATCH] Don't check for circular references of imports that don't have matching exports. This fix will avoid referring to a struct member through a null pointer. --- src/ld65/expr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ld65/expr.c b/src/ld65/expr.c index 5d6b56917..41db2326c 100644 --- a/src/ld65/expr.c +++ b/src/ld65/expr.c @@ -457,16 +457,14 @@ long GetExprVal (ExprNode* Expr) static void GetSegExprValInternal (ExprNode* Expr, SegExprDesc* D, int Sign) /* Check if the given expression consists of a segment reference and only -** constant values, additions and subtractions. If anything else is found, +** constant values, additions, and subtractions. If anything else is found, ** set D->TooComplex to true. ** Internal, recursive routine. */ { Export* E; - if (Expr == 0) { - return; - } + CHECK (Expr != 0); switch (Expr->Op) { @@ -483,7 +481,7 @@ static void GetSegExprValInternal (ExprNode* Expr, SegExprDesc* D, int Sign) */ if (ExportHasMark (E)) { CircularRefError (E); - } else { + } else if (E->Expr != 0) { MarkExport (E); GetSegExprValInternal (E->Expr, D, Sign); UnmarkExport (E);