You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When a file ends in a special quoted string and no newline, it will panic. A sample stack trace and test case has been included below.
% scc .
panic: runtime error: index out of range [649] with length 649
goroutine 98 [running]:
github.com/boyter/scc/processor.verifyIgnoreEscape(0xc000264000, 0xc000265200, 0xc000264900, 0xc000265b00, 0xc000266400, 0x7f2700237f00, 0x0, 0x0, 0x0, 0xc00019f5e0, ...)
/private/tmp/scc-20191015-33901-1vdnpeq/scc-2.9.0/src/github.com/boyter/scc/processor/workers.go:352 +0xca
github.com/boyter/scc/processor.blankState(0xc0004a4000, 0x286, 0x288, 0x1, 0xc00051f4a0, 0x0, 0x0, 0xc0000ac2b8, 0x3, 0x8, ...)
/private/tmp/scc-20191015-33901-1vdnpeq/scc-2.9.0/src/github.com/boyter/scc/processor/workers.go:317 +0x10f
github.com/boyter/scc/processor.CountStats(0xc0004a4000)
/private/tmp/scc-20191015-33901-1vdnpeq/scc-2.9.0/src/github.com/boyter/scc/processor/workers.go:459 +0xe38
github.com/boyter/scc/processor.fileProcessorWorker.func1(0xc0000a6120, 0xc000236000, 0xc0000a6180, 0xc000236010)
/private/tmp/scc-20191015-33901-1vdnpeq/scc-2.9.0/src/github.com/boyter/scc/processor/workers.go:743 +0x243
created by github.com/boyter/scc/processor.fileProcessorWorker
/private/tmp/scc-20191015-33901-1vdnpeq/scc-2.9.0/src/github.com/boyter/scc/processor/workers.go:709 +0xb0
To Reproduce
In theory this should match the line numbers for if the file ends in a newline, but that doesn't seem to be counted the same and I really didn't want to figure that out. I've included a regression test.
The text was updated successfully, but these errors were encountered:
belak
changed the title
Index out of range when file ends with a block comment and no newline
Panic when file ends with a block comment and no newline
Oct 15, 2019
Yep, no problem! I ran across this project yesterday and decided to try it against our repos... which ran into this bug. Seemed like a simple fix. :) Thanks for the quick response!
Describe the bug
When a file ends in a special quoted string and no newline, it will panic. A sample stack trace and test case has been included below.
To Reproduce
In theory this should match the line numbers for if the file ends in a newline, but that doesn't seem to be counted the same and I really didn't want to figure that out. I've included a regression test.
Expected behavior
For scc to not panic
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: