Skip to content

Increase the size of bufio.Scanner.Buffer to 10MiB. #188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions manifest/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ func ParseRelease(release *release.Release, includeTests bool) map[string]*Mappi

// Parse parses manifest strings into MappingResult
func Parse(manifest string, defaultNamespace string, excludedHooks ...string) map[string]*MappingResult {
// ensure we have a newline in front of the yaml seperator
// Ensure we have a newline in front of the yaml seperator
scanner := bufio.NewScanner(strings.NewReader("\n" + manifest))
scanner.Split(scanYamlSpecs)
//Allow for tokens (specs) up to 1M in size
scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), 1048576)
//Discard the first result, we only care about everything after the first separator
// Allow for tokens (specs) up to 10MiB in size
scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), 10485760)
// Discard the first result, we only care about everything after the first separator
scanner.Scan()

result := make(map[string]*MappingResult)
Expand All @@ -104,8 +104,8 @@ func Parse(manifest string, defaultNamespace string, excludedHooks ...string) ma
log.Fatalf("YAML unmarshal error: %s\nCan't unmarshal %s", err, content)
}

//Skip content without any metadata. It is probably a template that
//only contains comments in the current state.
// Skip content without any metadata. It is probably a template that
// only contains comments in the current state.
if parsedMetadata.APIVersion == "" && parsedMetadata.Kind == "" {
continue
}
Expand Down