From 5167dad198508e2dac10bf89c6b2991cfc791ee6 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 4 Jun 2021 01:17:38 +0200 Subject: guard against too low arguments to by checking whether the memory limit would be exceeded * Checking whether the allocation succeeded may not prevent exceeding the memory limit excessively. * Even if the memory limit is not exceeded, the allocation can fail theoretically and the program would terminate abnormally. This however is true for all allocations in SciTECO (via glib). * teco_memory_check() therefore now supports checking whether an allocation would exceed the memory limit which will be useful before very large or variable allocations in addition to the regular checking in teco_machine_main_step(). * As a sideeffect, this fixes the "Searching with large counts" test case on Mac OS where too large allocations were not detected as expected (apparently Mac OS happily gives out ridiculously large chunks of memory). Now, all platforms are guaranteed to have the same behaviour. --- tests/testsuite.at | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/testsuite.at b/tests/testsuite.at index 6c592a0..beed747 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -65,7 +65,7 @@ AT_SETUP([Searching with large counts]) # Even though the search will be unsuccessful, it will not be considered # a proper error, so the process return code is still 0. AT_CHECK([$SCITECO -e "2147483647@S/foo/"], 0, ignore, ignore) -# NOTE: In case of crashes, the return code should be >= 128 (at least on Linux). +# Will always break the memory limit which is considered an error. AT_CHECK([$SCITECO -e "-2147483648@S/foo/"], 1, ignore, ignore) AT_CLEANUP -- cgit v1.2.3