Skip to content

Commit

Permalink
fix(decode): Tests are now failing on negative dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
slashformotion committed Feb 16, 2022
1 parent cf41ff2 commit 92e8016
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ func (d *decoder) decodeHeader() error {
return errBadHeader
}
d.width, err = strconv.Atoi(string(headerFields[1]))
if err != nil {
if err != nil || d.width <= 0 {
return errBadHeader
}
d.height, err = strconv.Atoi(string(headerFields[2]))
if err != nil {
if err != nil || d.height <= 0 {
return errBadHeader
}
return nil
Expand Down

0 comments on commit 92e8016

Please sign in to comment.