fix: range validation on mapping (#2317)

This commit is contained in:
Kevin Wan
2022-08-28 17:49:26 +08:00
committed by GitHub
parent 1b477bbef9
commit a1466e1707
2 changed files with 63 additions and 1 deletions

View File

@@ -311,10 +311,20 @@ func parseNumberRange(str string) (*numberRange, error) {
right = math.MaxFloat64
}
if left >= right {
if left > right {
return nil, errNumberRange
}
// [2:2] valid
// [2:2) invalid
// (2:2] invalid
// (2:2) invalid
if left == right {
if !leftInclude || !rightInclude {
return nil, errNumberRange
}
}
return &numberRange{
left: left,
leftInclude: leftInclude,