-
-
Notifications
You must be signed in to change notification settings - Fork 294
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
SCC crashes with a nil pointer dereference in processor/workers.go line 450 if --no-duplicates
is specified and one of the files is empty. This is because CountStats skips initializing the hash object if the file is empty.
To Reproduce
$ mkdir test && cd test
$ touch go.c
$ scc --no-duplicates
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1222b51]
goroutine 11 [running]:
github.com/boyter/scc/v3/processor.processFile(0xc0000da000, 0xc000096048)
/Users/fluggo/software/extern/scc/processor/workers.go:450 +0x171
github.com/boyter/scc/v3/processor.fileProcessorWorker.func1(0xc000028540, 0xc00037e2b0, 0xc00037e2b8, 0xc00037e2c0, 0xc000028600, 0xc00037e2d0)
/Users/fluggo/software/extern/scc/processor/workers.go:375 +0x30b
created by github.com/boyter/scc/v3/processor.fileProcessorWorker
/Users/fluggo/software/extern/scc/processor/workers.go:346 +0xfc
$ echo thing > go.c
$ scc --no-duplicates
───────────────────────────────────────────────────────────────────────────────
Language Files Lines Blanks Comments Code Complexity
───────────────────────────────────────────────────────────────────────────────
C 1 1 0 0 1 0
───────────────────────────────────────────────────────────────────────────────
Total 1 1 0 0 1 0
───────────────────────────────────────────────────────────────────────────────
Estimated Cost to Develop (organic) $19
Estimated Schedule Effort (organic) 0.221524 months
Estimated People Required (organic) 0.007670
───────────────────────────────────────────────────────────────────────────────
Processed 6 bytes, 0.000 megabytes (SI)
───────────────────────────────────────────────────────────────────────────────
Desktop (please complete the following information):
- OS: macOS Catalina 10.15.7
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working