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

Commit b8d4dc7

Browse files
committed
Fix two crashers found by fuzzing
https://github.com/dvyukov/go-fuzz
1 parent 93a831d commit b8d4dc7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

reader.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func Decode(dst, src []byte) ([]byte, error) {
141141
length += ln
142142
}
143143

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

@@ -179,7 +179,12 @@ func Decode(dst, src []byte) ([]byte, error) {
179179
}
180180

181181
literal := d.dpos - d.ref
182+
182183
if literal < 4 {
184+
if int(d.dpos+4) > len(d.dst) {
185+
return nil, ErrCorrupt
186+
}
187+
183188
d.cp(4, decr[literal])
184189
} else {
185190
length += 4

0 commit comments

Comments
 (0)