monochromegane / the_platinum_searcher

A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings.
MIT License
2.81k stars 141 forks source link

panic: runtime error: slice bounds out of range #190

Open mernst opened 6 years ago

mernst commented 6 years ago

I am using pt version 2.1.5 downloaded from https://github.com/monochromegane/the_platinum_searcher/releases .

% pt --version
pt version 2.1.5
% uname -a
Linux godwit.cs.washington.edu 4.4.110-1.el7.elrepo.x86_64 #1 SMP Fri Jan 5 11:35:48 EST 2018 x86_64 x86_64 x86_64 GNU/Linux

When I ran pt --smart-case --global-gitignore --home-ptignore --hidden -e --nogroup --color -- travis_wait . pt crashed with panic: runtime error: slice bounds out of range Below is the complete output, which includes the stack trace.

checker-framework-branch-docker-tweaks/.travis.yml:37:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-fork-jasonmrx/.travis.yml:36:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-branch-master/.travis.yml:38:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-branch-annotated-jdk-2/.travis.yml:27:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-branch-ensuresqualifierif-with-annotation-arguments/.travis.yml:36:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-branch-create-annotated-jdk-2/.travis.yml:27:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-demos/.travis.yml:3:script: travis_wait 120 ./.travis-build.sh
annotation-tools-branch-issue-144/.travis.yml:21:# Using travis_wait here seems to cause the job to terminate after 1 minute
annotation-tools-fork-mernst/.travis.yml:24:# Using travis_wait here seems to cause the job to terminate after 1 minute
annotation-tools-branch-asm5-final/.travis.yml:21:# Using travis_wait here seems to cause the job to terminate after 1 minute
annotation-tools-branch-master/.travis.yml:24:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-fork-panacekcz-branch-postcondition-arguments/.travis.yml:38:# Using travis_wait here seems to cause the job to terminate after 1 minute
annotation-tools-branch-asm5-final-EXTRAFILES/.travis.yml:21:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-fork-mernst-branch-optional-demo-1/.travis.yml:36:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-fork-mernst-branch-optional-checker/.travis.yml:36:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-fork-kelloggm/.travis.yml:27:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-fork-panacekcz/.travis.yml:36:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-fork-mernst/.travis.yml:38:# Using travis_wait here seems to cause the job to terminate after 1 minute
checker-framework-nonnegative-checker/.travis.yml:3:script: travis_wait 120 ./.travis-build.sh
checker-framework-fork-twlogger/.travis.yml:27:# Using travis_wait here seems to cause the job to terminate after 1 minute
panic: runtime error: slice bounds out of range

goroutine 5 [running]:
panic(0x5a5480, 0xc420014280)
    /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/monochromegane/go-gitignore.(*initialPatternHolder).add(0xc4200614b8, 0xc4200146ef, 0x1)
    /home/ubuntu/go/src/github.com/monochromegane/go-gitignore/initial_holder.go:21 +0x609
github.com/monochromegane/go-gitignore.(*depthPatterns).set(0xc420a324e0, 0x1, 0xc4200146ef, 0x1)
    /home/ubuntu/go/src/github.com/monochromegane/go-gitignore/depth_holder.go:67 +0x134
github.com/monochromegane/go-gitignore.(*depthPatternHolder).add(0xc420a324e0, 0xc4200146ef, 0x1)
    /home/ubuntu/go/src/github.com/monochromegane/go-gitignore/depth_holder.go:24 +0xac
github.com/monochromegane/go-gitignore.(*indexScanPatterns).add(0xc420a324e0, 0xc4200146ef, 0x1)
    /home/ubuntu/go/src/github.com/monochromegane/go-gitignore/index_scan_patterns.go:19 +0x51
github.com/monochromegane/go-gitignore.NewGitIgnoreFromReader(0xc420a32420, 0x20, 0x69d880, 0xc420c30090, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/ubuntu/go/src/github.com/monochromegane/go-gitignore/gitignore.go:54 +0x3fa
github.com/monochromegane/go-gitignore.NewGitIgnore(0xc420182780, 0x2b, 0xc4200617b0, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0)
    /home/ubuntu/go/src/github.com/monochromegane/go-gitignore/gitignore.go:35 +0x151
github.com/monochromegane/the_platinum_searcher.newIgnoreMatchers(0xc420a32420, 0x20, 0xc420015920, 0x1, 0x1, 0xc420a32401, 0xc420061800, 0x4408f1)
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/ignore.go:29 +0x172
github.com/monochromegane/the_platinum_searcher.find.findFile.func1(0xc420a32420, 0x20, 0xc420a328e0, 0x1a, 0x69fa00, 0xc42096e820, 0x4, 0xc420108640, 0x3, 0x4, ...)
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/find.go:82 +0x1d3
github.com/monochromegane/the_platinum_searcher.walk(0xc420a32420, 0x20, 0xc420a328e0, 0x1a, 0x69fa00, 0xc42096e820, 0x4, 0xc420108640, 0x3, 0x4, ...)
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/walk.go:22 +0xe4
github.com/monochromegane/the_platinum_searcher.walk(0xc420a328e0, 0x1a, 0xc420204119, 0x7, 0x69fa00, 0xc4201961a0, 0x4, 0xc4201115a0, 0x2, 0x2, ...)
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/walk.go:52 +0x57e
github.com/monochromegane/the_platinum_searcher.walk(0xc420204119, 0x7, 0x7ffebcc7d88d, 0x1, 0x69fa00, 0xc420156b60, 0x3, 0xc4201115a0, 0x2, 0x2, ...)
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/walk.go:52 +0x57e
github.com/monochromegane/the_platinum_searcher.walk(0x7ffebcc7d88d, 0x1, 0x7ffebcc7d88d, 0x1, 0x69fa00, 0xc4201169c0, 0x2, 0xc4201115a0, 0x2, 0x2, ...)
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/walk.go:52 +0x57e
github.com/monochromegane/the_platinum_searcher.concurrentWalk(0x7ffebcc7d88d, 0x1, 0xc4201115a0, 0x2, 0x2, 0xc420111500, 0xc420108900, 0x2, 0x0)
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/walk.go:18 +0x122
github.com/monochromegane/the_platinum_searcher.find.findFile(0xc42001e240, 0x5eb600, 0xc4200b20c0, 0xc420024380, 0x7ffebcc7d88d, 0x1, 0x0)
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/find.go:108 +0x179
github.com/monochromegane/the_platinum_searcher.find.start(0xc42001e240, 0xc4200b2000, 0xc4200b20c0, 0xc420024380, 0xc4200a21f0, 0x1, 0x9, 0x0)
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/find.go:23 +0xb6
created by github.com/monochromegane/the_platinum_searcher.search.start
    /home/ubuntu/go/src/github.com/monochromegane/the_platinum_searcher/search.go:62 +0x247