summaryrefslogtreecommitdiff
path: root/src/context
diff options
context:
space:
mode:
authorAndres Notzli <andres.noetzli@gmail.com>2016-11-02 16:55:37 -0700
committerAndres Notzli <andres.noetzli@gmail.com>2016-11-02 17:09:55 -0700
commit520e4a0638675dad2fa66a50e5fd64786c6f889f (patch)
tree008e517455ecfcdfa3d25a17d2ba73a9638d0593 /src/context
parentf1427165156dff24d7b8ca0690088e4182ccdbd4 (diff)
Fix back() of empty deque in context_mm_black test
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.
Diffstat (limited to 'src/context')
-rw-r--r--src/context/context_mm.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/context/context_mm.cpp b/src/context/context_mm.cpp
index 2dc2c03bb..ac7d7f8cf 100644
--- a/src/context/context_mm.cpp
+++ b/src/context/context_mm.cpp
@@ -104,6 +104,8 @@ void ContextMemoryManager::push() {
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();
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback