Skip to content

Commit 803a15e

Browse files
craig[bot]mw5h
andcommitted
Merge #153054
153054: vecstore: when reusing memory, set length to the desired length r=mw5h a=mw5h Previously, when reusing memory for the output field, PKDecoder.Init() would truncate the output field instead of setting it to the desired length. This could lead to a runtime out of bounds memory reference. Epic: none Release note (bug fix): An issue that could cause vector index uses to throw an out of bounds access exception has been fixed. Co-authored-by: Matt White <[email protected]>
2 parents 4595a31 + 4e040cf commit 803a15e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/sql/vecindex/vecstore/store_txn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ func (d *PKDecoder) Init(fetchSpec *fetchpb.IndexFetchSpec) {
384384
if cap(d.output) < len(fetchSpec.FetchedColumns) {
385385
d.output = make(rowenc.EncDatumRow, len(fetchSpec.FetchedColumns))
386386
} else {
387-
d.output = d.output[:0]
387+
d.output = d.output[:len(fetchSpec.FetchedColumns)]
388388
}
389389
for i, col := range fetchSpec.FetchedColumns {
390390
d.colOrdMap.Set(col.ColumnID, i)

0 commit comments

Comments
 (0)