From 33f71654136014bac094babaaa81d91245fdd24c Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 21 Mar 2025 13:26:01 +0300 Subject: fixed rubout of Q-Register specifications * This was a regression introduced by 257a0bf128e109442dce91c4aaa1d97fed17ad1a. * The undo token that frees newly allocated teco_machine_qregspec_t must actually reset the pointer as well since any subsequent token, pushed by teco_undo_qregspec_own(), will expect a valid pointer. * Could have been done via ctx->expectqreg = NULL; teco_undo_qregspec_own(ctx->expectqreg); but using a special clear function requires less memory and is easier to understand. * Added test case. This wouldn't always crash, but should definitely show up in Valgrind. --- tests/testsuite.at | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests') diff --git a/tests/testsuite.at b/tests/testsuite.at index 86f8331..1c42fe9 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -310,6 +310,12 @@ AT_CHECK([$SCITECO_CMDLINE "@I/F/ J @I/X/ @FK/F/{-6D} Z-2\"N(0/0)'"], 0, ignore, AT_FAIL_IF([$GREP "^Error:" stderr]) AT_CLEANUP +AT_SETUP([Rub out Q-Register specifications]) +# This was causing memory corruptions, that would at least show up under Valgrind. +AT_CHECK([$SCITECO_CMDLINE "GaGb{-4D}"], 0, ignore, stderr) +AT_FAIL_IF([$GREP "^Error:" stderr]) +AT_CLEANUP + AT_SETUP([Searches from macro calls]) AT_CHECK([$SCITECO_CMDLINE "@^Um{:@S/XXX/} :Mm\"S(0/0)' Mm\"S(0/0)'"], 0, ignore, stderr) AT_FAIL_IF([$GREP "^Error:" stderr]) -- cgit v1.2.3