Skip to content

panic: runtime error: index out of range [65533] with length 55868 #503

@ishansharma29

Description

@ishansharma29

Describe the bug
Index out of range, might need to change some variables for bigger repos.

To Reproduce
for one of my git repo, it threw index out of bound

Expected behavior
Should just scan for vulnerabilities and generate the report.

Screenshots
panic: runtime error: index out of range [65533] with length 55868

goroutine 978 [running]:
github.com/sergi/go-diff/diffmatchpatch.(*DiffMatchPatch).DiffCharsToLines(0xc05c1e1ec0, 0xc040ea9320, 0x1, 0x2, 0xc04527a000, 0xda3c, 0xec00, 0x2f000, 0xc040ea9320, 0x1)
github.com/sergi/go-diff@v1.1.0/diffmatchpatch/diff.go:452 +0x328
github.com/go-git/go-git/v5/utils/diff.DoWithTimeout(0xc04e78c000, 0xf8409a, 0x0, 0x0, 0x34630b8a000, 0x0, 0x0, 0x0)
github.com/go-git/go-git/v5@v5.2.0/utils/diff/diff.go:37 +0x1b8
github.com/go-git/go-git/v5/utils/diff.Do(...)
github.com/go-git/go-git/v5@v5.2.0/utils/diff/diff.go:22
github.com/go-git/go-git/v5/plumbing/object.filePatchWithContext(0x15968e0, 0xc00002a0b0, 0xc040eaa380, 0x8, 0x9, 0xc0410da400, 0x8)
github.com/go-git/go-git/v5@v5.2.0/plumbing/object/patch.go:68 +0x23e
github.com/go-git/go-git/v5/plumbing/object.getPatchContext(0x15968e0, 0xc00002a0b0, 0x0, 0x0, 0xc0408c6960, 0x39, 0x39, 0x39, 0x0, 0x0)
github.com/go-git/go-git/v5@v5.2.0/plumbing/object/patch.go:38 +0xce
github.com/go-git/go-git/v5/plumbing/object.Changes.PatchContext(...)
github.com/go-git/go-git/v5@v5.2.0/plumbing/object/change.go:158
github.com/go-git/go-git/v5/plumbing/object.(*Tree).PatchContext(0xc040cb4280, 0x15968e0, 0xc00002a0b0, 0xc040cb4320, 0xc0e8639fac, 0xc040cb4320, 0x0)
github.com/go-git/go-git/v5@v5.2.0/plumbing/object/tree.go:339 +0xcc
github.com/go-git/go-git/v5/plumbing/object.(*Commit).PatchContext(0xc040cc8000, 0x15968e0, 0xc00002a0b0, 0xc00235e1e0, 0x0, 0x0, 0xc040c90680)
github.com/go-git/go-git/v5@v5.2.0/plumbing/object/commit.go:98 +0xc5
github.com/go-git/go-git/v5/plumbing/object.(*Commit).Patch(...)
github.com/go-git/go-git/v5@v5.2.0/plumbing/object/commit.go:106
github.com/zricethezav/gitleaks/v7/scan.(*CommitScanner).Scan(0xc05c1e3d30, 0x7ffeefbff7dc, 0x40, 0x0, 0x0, 0x0, 0x0)
github.com/zricethezav/gitleaks/v7/scan/commit.go:64 +0x14e
github.com/zricethezav/gitleaks/v7/scan.(*RepoScanner).Scan.func2(0x0, 0x0)
github.com/zricethezav/gitleaks/v7/scan/repo.go:88 +0x21a
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc01d096ab0, 0xc040c906a0)
golang.org/x/sync@v0.0.0-20201020160332-67f06af15bc9/errgroup/errgroup.go:57 +0x59
created by golang.org/x/sync/errgroup.(*Group).Go
golang.org/x/sync@v0.0.0-20201020160332-67f06af15bc9/errgroup/errgroup.go:54 +0x66

Basic Info (please complete the following information):

  • OS: MacOS
  • Gitleaks Version: latest

Additional context
NA

cc @zricethezav

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions