Skip to content

Commit

Permalink
Fix #843: crasher in test_load()
Browse files Browse the repository at this point in the history
  • Loading branch information
thefallentree committed Sep 9, 2021
1 parent beb357a commit 9708040
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vm/internal/otable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ bool ObjectTable::remove(Key const& key) {
objects_.erase(it1);
// guaranteed to exist if object exists
auto it2 = children_.find(basename(key));
if (it2 == children_.end()) return false;
auto it3 = std::find_if(it2->second.begin(), it2->second.end(),
[&key](Value v) -> bool { return v->obname == key; });
// guaranteed to be in list if basename(key) exists in children_
if (it3 == it2->second.end()) return false;
it2->second.erase(it3);
if (it2->second.size() == 0) {
children_.erase(it2);
Expand Down
3 changes: 3 additions & 0 deletions testsuite/single/tests/crasher/843.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
void do_tests() {
test_load(__FILE__);
}

0 comments on commit 9708040

Please sign in to comment.