Skip to content

Commit

Permalink
🐛 handle error on invalid byte read in *decoder.decodeHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
slashformotion committed Jan 5, 2022
1 parent e119d86 commit 4c79f15
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ func (d *decoder) decodeHeader() error {

comment := false
for fields := 0; fields < 3; {
b, _ = d.br.ReadByte()
b, err = d.br.ReadByte()
if err != nil {
return errBadHeader
}

if b == '#' {
comment = true
} else if !comment {
Expand Down

0 comments on commit 4c79f15

Please sign in to comment.