From 4c94542e7fcb386c320a56490ad57d61a510a79f Mon Sep 17 00:00:00 2001 From: Josh Davies Date: Wed, 15 Oct 2025 20:24:34 +0100 Subject: [PATCH] fix: infinite loops in parsing/tokenising This fixes two infinite loops after error conditions, discovered by afl++. --- sources/dict.c | 2 +- sources/token.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/dict.c b/sources/dict.c index ac5810624..39c285281 100644 --- a/sources/dict.c +++ b/sources/dict.c @@ -801,7 +801,7 @@ int SetDictionaryOptions(UBYTE *options) AO.CurDictInDollars = DICT_NOTINDOLLARS; while ( *s ) { opt = s; - while ( *s && *s != ',' && *s != ' ' ) s++; + while ( *s && *s != ',' ) s++; c = *s; *s = 0; if ( opt[0] == '$' && opt[1] == 0 ) { AO.CurDictInDollars = DICT_INDOLLARS; diff --git a/sources/token.c b/sources/token.c index c87307f07..e5b92b2a1 100644 --- a/sources/token.c +++ b/sources/token.c @@ -318,7 +318,8 @@ donumber: i = 0; } else if ( spec == -1 ) { MesPrint("&The floating point system has not been started: %s",in); - if ( !error ) error = 1; + if ( !error ) error = 1; + in++; } else { UBYTE *a = s; s = in; in = a;