Skip to content

Commit

Permalink
tools/syz-cover: skip empty lines in coverage file
Browse files Browse the repository at this point in the history
If it's constructed manually, it's easy to add an empty line at the end.
  • Loading branch information
dvyukov committed Jul 18, 2019
1 parent f613a7c commit 06616a2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tools/syz-cover/syz-cover.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"path/filepath"
"runtime"
"strconv"
"strings"

"github.com/google/syzkaller/pkg/cover"
"github.com/google/syzkaller/pkg/osutil"
Expand Down Expand Up @@ -94,7 +95,11 @@ func readPCs(files []string) ([]uint64, error) {
return nil, err
}
for s := bufio.NewScanner(bytes.NewReader(data)); s.Scan(); {
pc, err := strconv.ParseUint(s.Text(), 0, 64)
line := strings.TrimSpace(s.Text())
if line == "" {
continue
}
pc, err := strconv.ParseUint(line, 0, 64)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 06616a2

Please sign in to comment.