Commit 0edac9d
authored
fix: resize Segment data_ to match capacity in ConcurrentArrayInvertedLists (#1641)
The Segment helper in ConcurrentArrayInvertedLists reserves data_'s
capacity but never sizes it, so std::vector::size() stays 0 while
operator[] reads and writes at offsets within capacity. That is
undefined behavior; on a libstdc++ built with -D_GLIBCXX_ASSERTIONS,
operator[] has a bounds check compiled in and the process aborts on
the first growing-segment write (e.g. an IVF_FLAT_CC insert).
Switch reserve() to resize() so size() == capacity() and operator[]
is in-bounds. Same allocation, plus a zero-fill that the subsequent
memcpy overwrites; no measurable runtime cost. Behavior on unhardened
libstdc++ is unchanged.
Signed-off-by: Michael Paul <31833332+MickeyPvX@users.noreply.github.com>1 parent fca2aaf commit 0edac9d
1 file changed
Lines changed: 1 addition & 1 deletion
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
0 commit comments