Re: [RFC PATCH v10 32.5/36] unpack_trees: fix memory corruption with split_index when src != dst

2018-04-23 Thread Elijah Newren
On Mon, Apr 23, 2018 at 10:37 AM, Duy Nguyen wrote: >>> [1] To me the second parameter should be src_index, not dst_index. >>> We're copying entries from _source_ index to "result" and we should >>> also copy extensions from the source index. That line happens to work >>> only

Re: [RFC PATCH v10 32.5/36] unpack_trees: fix memory corruption with split_index when src != dst

2018-04-23 Thread Duy Nguyen
On Mon, Apr 23, 2018 at 7:09 PM, Elijah Newren wrote: > Hi, > > On Sun, Apr 22, 2018 at 5:38 AM, Duy Nguyen wrote: >>> - there's a better, more performant fix or there is some way to actually >>> share a split_index between two independent index_state

Re: [RFC PATCH v10 32.5/36] unpack_trees: fix memory corruption with split_index when src != dst

2018-04-23 Thread Elijah Newren
Hi, On Sun, Apr 22, 2018 at 5:38 AM, Duy Nguyen wrote: >> - there's a better, more performant fix or there is some way to actually >> share a split_index between two independent index_state objects. > > A cleaner way of doing this would be something to the line [1] > >

Re: [RFC PATCH v10 32.5/36] unpack_trees: fix memory corruption with split_index when src != dst

2018-04-22 Thread Duy Nguyen
On Sat, Apr 21, 2018 at 9:37 PM, Elijah Newren wrote: > Currently, all callers of unpack_trees() set o->src_index == o->dst_index. > Since we create a temporary index in o->result, then discard o->dst_index > and overwrite it with o->result, when o->src_index == o->dst_index it

Re: [RFC PATCH v10 32.5/36] unpack_trees: fix memory corruption with split_index when src != dst

2018-04-21 Thread Elijah Newren
On Sat, Apr 21, 2018 at 12:37 PM, Elijah Newren wrote: > Currently, all callers of unpack_trees() set o->src_index == o->dst_index. > Since we create a temporary index in o->result, then discard o->dst_index > and overwrite it with o->result, when o->src_index == o->dst_index it

[RFC PATCH v10 32.5/36] unpack_trees: fix memory corruption with split_index when src != dst

2018-04-21 Thread Elijah Newren
Currently, all callers of unpack_trees() set o->src_index == o->dst_index. Since we create a temporary index in o->result, then discard o->dst_index and overwrite it with o->result, when o->src_index == o->dst_index it is safe to just reuse o->src_index's split_index for o->result. However,