Skip to content

Instantly share code, notes, and snippets.

@posquit0
Last active August 25, 2026 13:21
Show Gist options
  • Select an option

  • Save posquit0/60c94875200e7b4a3a1b9bd453c01555 to your computer and use it in GitHub Desktop.

Select an option

Save posquit0/60c94875200e7b4a3a1b9bd453c01555 to your computer and use it in GitHub Desktop.
Anonymized TruffleHog pathFromBinaryLine panic trace
TruffleHog 3.97.0
panic: runtime error: slice bounds out of range [:-7]
goroutine 1 [running]:
github.com/trufflesecurity/trufflehog/v3/pkg/gitparse.pathFromBinaryLine(...)
pkg/gitparse/gitparse.go
github.com/trufflesecurity/trufflehog/v3/pkg/gitparse.TestBinaryPathParseMalformedLine(...)
pkg/gitparse/gitparse_test.go
Minimal input:
[]byte("Binary files /dev/null and b/\n")
The parser finds ` and b/`, then evaluates `after[:len(after)-8]` while
`after` contains only the trailing newline. The expected behavior is to reject
the malformed/truncated line without panicking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment