about summary refs log tree commit diff homepage
path: root/unittests
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2023-11-20 22:41:19 +0000
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2024-01-30 17:56:08 +0000
commitf813c88c8cb868fc9c0be78fbf92a94d72ac02b0 (patch)
tree6647c2eb38a4a1502d9806bcdbfd919a07acaedc /unittests
parentcb5e898561f9b8769d8838bc1bdca17a6f4f5d20 (diff)
downloadklee-f813c88c8cb868fc9c0be78fbf92a94d72ac02b0.tar.gz
Avoid generating array names in solver builders that could accidently collide
If an array name ended with a number, adding a number-only suffix could
generate the same name used as part of the solvers.

In the specific testcase `val_1` became solver array `val_111` which
collided with array `val_11` that became `val_111` as well.

Using an `_` as prefix for the suffix, solves that problem in general,
i.e. `val_1` becomes `val_1_11` and `val_11` becomes `val_11_1`.

Fixes #1668
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Solver/Z3SolverTest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/unittests/Solver/Z3SolverTest.cpp b/unittests/Solver/Z3SolverTest.cpp
index e81ff19e..0eba3d0e 100644
--- a/unittests/Solver/Z3SolverTest.cpp
+++ b/unittests/Solver/Z3SolverTest.cpp
@@ -64,7 +64,7 @@ TEST_F(Z3SolverTest, GetConstraintLog) {
   // Ensure this is not buggy as fixed in https://github.com/klee/klee/pull/1235
   // If the bug is still present this fail due to an internal assertion
   char *ConstraintsString = Z3Solver_->getConstraintLog(TheQuery);
-  const char *ExpectedArraySelection = "(= (select const_array0";
+  const char *ExpectedArraySelection = "(= (select const_array_0";
   const char *Occurence = std::strstr(ConstraintsString, ExpectedArraySelection);
   ASSERT_STRNE(Occurence, nullptr);
   free(ConstraintsString);