The `testPushPop()` test case does a pop out of scope at the end that
lead to UB in `ContextManager::pop()` because it did a `deque::back()`
on an empty deque without checking. This commit adds an assertion in the
`ContextManager` and checks that the test case triggers the assertion.
void ContextMemoryManager::pop() {
+ Assert(d_nextFreeStack.size() > 0 && d_endChunkStack.size() > 0);
+
// Restore state from stack
d_nextFree = d_nextFreeStack.back();
d_nextFreeStack.pop_back();
//Used in some of the tests
#include <vector>
#include <iostream>
+
#include "context/context_mm.h"
+#include "base/cvc4_assert.h"
+
using namespace std;
using namespace CVC4::context;
}
// Try popping out of scope
- d_cmm->pop();
+ TS_ASSERT_THROWS(d_cmm->pop(), CVC4::AssertionException);
}
void tearDown() {