Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix dangling pointer to state buffer in state registry #190

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/search/state_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ State StateRegistry::get_successor_state(const State &predecessor, const Operato
state_packer.set(buffer, i, new_values[i]);
}
StateID id = insert_id_or_pop_state();
// See below for the case withou axioms on why we need to reset buffer.
FlorianPommerening marked this conversation as resolved.
Show resolved Hide resolved
buffer = state_data_pool[id.value];
return task_proxy.create_state(*this, id, buffer, move(new_values));
} else {
for (EffectProxy effect : op.get_effects()) {
Expand All @@ -91,6 +93,17 @@ State StateRegistry::get_successor_state(const State &predecessor, const Operato
}
}
StateID id = insert_id_or_pop_state();
/*
insert_id_or_pop_state deletes the state data pointed to by buffer
if the state already exists. We need to use the buffer corresponding
to the right state. NOTE: the below code is exactly what lookup_state
does, but for symmetry with the above case for axioms and for future
refactoring, we explicitly set buffer here.
FlorianPommerening marked this conversation as resolved.
Show resolved Hide resolved

TODO: ideally, we would not modify state_data_pool here and in
insert_id_or_pop_state, but only at one place.
FlorianPommerening marked this conversation as resolved.
Show resolved Hide resolved
*/
buffer = state_data_pool[id.value];
return task_proxy.create_state(*this, id, buffer);
}
}
Expand Down