Skip to content

Commit 8f7f6d2

Browse files
committed
fix: integer overflow conversion int
1 parent b73ba03 commit 8f7f6d2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

internal/hook/hook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,15 +412,15 @@ func GetParameter(s string, params interface{}) (interface{}, error) {
412412
// Check if we need to traverse deeper
413413
if p := strings.SplitN(s, ".", 2); len(p) > 1 {
414414
index, err := strconv.ParseUint(p[0], 10, 64)
415-
if err != nil || uint64(paramsValueSliceLength) <= index {
415+
if err != nil || index > math.MaxInt || int(index) >= paramsValueSliceLength {
416416
return nil, &ParameterNodeError{s}
417417
}
418418
return GetParameter(p[1], params.([]interface{})[index])
419419
}
420420

421421
// Direct index access
422422
index, err := strconv.ParseUint(s, 10, 64)
423-
if err != nil || uint64(paramsValueSliceLength) <= index {
423+
if err != nil || index > math.MaxInt || int(index) >= paramsValueSliceLength {
424424
return nil, &ParameterNodeError{s}
425425
}
426426
return params.([]interface{})[index], nil

0 commit comments

Comments
 (0)