Skip to content

Commit 50ff7d3

Browse files
committed
[DH] Fix pick_up_fragment crash on Vengeance with multiple threads
consume_soul_fragments() deletes fragments via remove() but didn't cancel a pending pick_up_fragment event that may hold a pointer to one of them. The event then dereferences freed memory. consume_nearby_soul_fragments() already cancels the event correctly; this brings consume_soul_fragments() in line.
1 parent 09b14c5 commit 50ff7d3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

engine/class_modules/sc_demon_hunter.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12104,6 +12104,10 @@ unsigned demon_hunter_t::consume_soul_fragments( soul_fragment type, bool instan
1210412104
}
1210512105
}
1210612106

12107+
// Cancel any pending pick_up_fragment event since consume() below will
12108+
// delete the fragment it may be referencing, causing a use-after-free.
12109+
event_t::cancel( soul_fragment_pick_up );
12110+
1210712111
for ( auto& it : candidates )
1210812112
{
1210912113
it->consume( instant );

0 commit comments

Comments
 (0)