From b409fdd247b54483526342c717a7bd508f2a7419 Mon Sep 17 00:00:00 2001 From: novusr Date: Thu, 26 Feb 2026 04:21:10 +0800 Subject: [PATCH] fix: Prevent infinite loop during preprocessing when file reading stops. --- source/compiler/sc2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index f99de201..60d41280 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -2125,6 +2125,10 @@ static const unsigned char *unpackedstring(const unsigned char *lptr,int *flags) } imlstring=MULTILINE|(*flags & RAWMODE); preprocess(); + if (!freading) { + imlstring=0; + break; + } lptr=pline; } /* for */ litadd(0); @@ -2229,6 +2233,10 @@ static const unsigned char *packedstring(const unsigned char *lptr,int *flags) } imlstring=MULTILINE|(*flags & RAWMODE); preprocess(); + if (!freading) { + imlstring=0; + break; + } lptr=pline; } /* for */ /* save last code; make sure there is at least one terminating zero character */