Skip to content

Commit 6b934de

Browse files
committed
A couple modifications of the last use-after-free fix.
1 parent 8f3e229 commit 6b934de

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libpharos/apigraph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,8 @@ void ApiSearchExecutor::UpdateApiMatchTable(rose_addr_t caller, rose_addr_t call
816816
assert(cur_list);
817817

818818
auto & clist = *cur_list;
819-
for (std::size_t i = 0; i < clist.size(); ++i) {
819+
auto end = clist.size();
820+
for (std::size_t i = 0; i < end; ++i) {
820821
// for each recorded alias
821822
ApiParameterPtr cur_pd = clist[i];
822823
if (!cur_pd) {
@@ -2479,14 +2480,13 @@ rose_addr_t ApiCfgComponent::ConsolidateReturns(BlockSet & retns) {
24792480
return INVALID_ADDRESS;
24802481
}
24812482

2482-
ApiVertexInfo &exit_info = (*cfg_)[exit_vertex]; // the vertex that corresponds to exit_
2483-
24842483
for (const BlockSet::value_type & block : retns) {
24852484
ApiCfgVertex vtx = GetVertexByAddr(block->get_address());
24862485
if (vtx == NULL_VERTEX) {
24872486
continue;
24882487
}
2489-
if (block->get_address() != exit_info.block->get_address()) { // Not the exit vertex
2488+
if (block->get_address() != (*cfg_)[exit_vertex].block->get_address()) {
2489+
// Not the exit vertex
24902490
// make the predecessors of the vertex to remove point to the one true return
24912491
BGL_FORALL_INEDGES(vtx,in_edge,*cfg_,ApiCfg) {
24922492
ApiCfgVertex src = boost::source(in_edge, *cfg_);

0 commit comments

Comments
 (0)