From 5f141848b88237959bd01603b427b792828d73ad Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 6 Nov 2024 23:50:09 +0300 Subject: fixed the Q-Reg spec machine used for implementing S^EGq$ (match one of characters in Q-Register) * It was initialized only once, so it could inherit the wrong local Q-Register table. A test case has been added for this particular bug. * Also, if starting from the profile (batch mode), the state machine could be initialized without undo, which then later cause problems on rubout in interactive mode. For instance, if S^EG[a] fails and you would repeatedly type `]`, the Q-Reg name could grow indefinitely. There were probably other issues as well. Even crashes should have been possible, although I couldn't reproduce them. * Since the state machine is required only for the pattern to regexp translation and is performed anew for every character in interactive mode, we now create a fresh state machine for every call and don't attempt any undo. There might be more efficient ways, like reusing the string building's Q-Reg parser state machine. --- tests/testsuite.at | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/testsuite.at b/tests/testsuite.at index 3770bbe..30ae985 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -182,6 +182,10 @@ AT_SETUP([Search for one of characters in uninitialized Q-Register]) AT_CHECK([$SCITECO -e ":@S/^EGa/\"S(0/0)'"], 0, ignore, ignore) AT_CLEANUP +AT_SETUP([Search accesses wrong Q-Register table]) +AT_CHECK([$SCITECO -e '@^U.#xx/123/ @^Um{:@S/^EG.#xx/$} :Mm Mm'], 1, ignore, ignore) +AT_CLEANUP + AT_SETUP([Memory limiting during spawning]) # This might result in an OOM if memory limiting is not working AT_CHECK([$SCITECO -e "50*1000*1000,2EJ 0,128ED @EC'dd if=/dev/zero'"], 1, ignore, ignore) -- cgit v1.2.3