From fe50213c78bb06a8d8a77ad55c0ea6198a8b947a Mon Sep 17 00:00:00 2001 From: Aleksandr Razumov Date: Tue, 14 Jun 2022 11:58:31 +0300 Subject: [PATCH] fix(proto): handle index out of range in low cardinality --- proto/col_low_cardinality.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proto/col_low_cardinality.go b/proto/col_low_cardinality.go index e182449d..c1c2851a 100644 --- a/proto/col_low_cardinality.go +++ b/proto/col_low_cardinality.go @@ -185,6 +185,9 @@ func (c *ColLowCardinality[T]) DecodeColumn(r *Reader, rows int) error { c.Values = c.Values[:0] for _, idx := range c.keys { + if int64(idx) >= indexRows { + return errors.Errorf("key index out of range [%d] with length %d", idx, indexRows) + } c.Values = append(c.Values, c.index.Row(idx)) }