In index.go there is the function hasPrefix()
func (o *IndexDef) hasPrefix(columns []string) bool {
if len(o.Columns) < len(columns) {
return false
}
for i := range o.Columns {
if o.Columns[i] != columns[i] {
return false
}
}
return true
}
This causes an index out of bounds exception if the length of o.Columns is longer than that of columns since we are iterating through o.Columns in the for loop.
This check should be if len(o.Columns) > len(columns) to make sure we are not iterating through the longer array.
After making this change, all the tests continue to pass as expected.
In
index.gothere is the functionhasPrefix()This causes an index out of bounds exception if the length of
o.Columnsis longer than that ofcolumnssince we are iterating througho.Columnsin theforloop.This check should be
if len(o.Columns) > len(columns)to make sure we are not iterating through the longer array.After making this change, all the tests continue to pass as expected.