Fix out-of-bounds access in genRangeInclusive
This commit is contained in:
@@ -99,7 +99,7 @@ func Reduce[T any](slc []T, fn func(T, T) T) T {
|
|||||||
|
|
||||||
// Generate numbers in a range - start to end (both inclusive)
|
// Generate numbers in a range - start to end (both inclusive)
|
||||||
func genRangeInclusive[T character](start, end T) []T {
|
func genRangeInclusive[T character](start, end T) []T {
|
||||||
toRet := make([]T, end-start)
|
toRet := make([]T, (end-start)+1)
|
||||||
for i := start; i <= end; i++ {
|
for i := start; i <= end; i++ {
|
||||||
toRet[i-start] = i
|
toRet[i-start] = i
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user