Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Commit

Permalink
Fix two crashers found by fuzzing
Browse files Browse the repository at this point in the history
  • Loading branch information
dgryski committed May 4, 2015
1 parent 93a831d commit b8d4dc7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func Decode(dst, src []byte) ([]byte, error) {
length += ln
}

if int(d.spos+length) > len(d.src) {
if int(d.spos+length) > len(d.src) || int(d.dpos+length) > len(d.dst) {
return nil, ErrCorrupt
}

Expand Down Expand Up @@ -179,7 +179,12 @@ func Decode(dst, src []byte) ([]byte, error) {
}

literal := d.dpos - d.ref

if literal < 4 {
if int(d.dpos+4) > len(d.dst) {
return nil, ErrCorrupt
}

d.cp(4, decr[literal])
} else {
length += 4
Expand Down

0 comments on commit b8d4dc7

Please sign in to comment.