When changing the direction of the multi-cf-iter, we do this by Seek(current_key) (if changing from backward to forward) or SeekForPrev(current_key) (if forward -> backward) in the child iters and rebuild the heap.
Slice target is just a pointer and contents are not guaranteed to be the same after re-init the heap.
Test Plan
I was able to steadily repro by building with COMPILE_WITH_ASAN=1 running db_stress.
Summary
When changing the direction of the multi-cf-iter, we do this by
Seek(current_key)
(if changing from backward to forward) orSeekForPrev(current_key)
(if forward -> backward) in the child iters and rebuild the heap.Slice target
is just a pointer and contents are not guaranteed to be the same after re-init the heap.Test Plan
I was able to steadily repro by building with
COMPILE_WITH_ASAN=1
running db_stress.heap-use-after-free
was no longer happening with the same command after making the change.