diff --git a/pkg/result/processors/autogenerated_exclude.go b/pkg/result/processors/autogenerated_exclude.go index cc5883d9..d804351b 100644 --- a/pkg/result/processors/autogenerated_exclude.go +++ b/pkg/result/processors/autogenerated_exclude.go @@ -120,6 +120,15 @@ func getDoc(filePath string) (string, error) { defer file.Close() scanner := bufio.NewScanner(file) + + // Issue 954: Some lines can be very long, e.g. auto-generated + // embedded resources. Reported on file of 86.2KB. + const ( + maxSize = 512 * 1024 // 512KB should be enough + initialSize = 4096 // same as startBufSize in bufio + ) + scanner.Buffer(make([]byte, initialSize), maxSize) + var docLines []string for scanner.Scan() { line := strings.TrimSpace(scanner.Text())