diff --git a/pkg/inventory/pckg/collector/maven/gradle_file_parser.go b/pkg/inventory/pckg/collector/maven/gradle_file_parser.go index d21e9026ac15e776df7f4c80cad7768626bce11a..23ade53fd806aca9d8ae8f268c401f1f31c259de 100644 --- a/pkg/inventory/pckg/collector/maven/gradle_file_parser.go +++ b/pkg/inventory/pckg/collector/maven/gradle_file_parser.go @@ -129,6 +129,11 @@ func parseGradleFile(reader io.Reader, sourcePath string) ([]model.Package, erro }) + 1 end := len(line) - 1 + + // Avoid crossing the line + if start <= 0 || start >= end { + continue + } dependencyStr := trimCustomString(line[start:end], trimStringArr) dependencyParts := strings.Split(dependencyStr, ":")