Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion vp8l/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,12 @@ func (d *decoder) decodePix(w int32, h int32, minCap int32, topLevel bool) ([]by
return nil, err
}
dist := distanceMap(w, distCode)
pEnd := p + 4*int(length)
// Ensure length is not so large that 4*length overflows an int.
if int64(length) > math.MaxInt32 {
return errInvalidString
}
pEnd := p + 4*int(length)

q := p - 4*int(dist)
qEnd := pEnd - 4*int(dist)
if p < 0 || len(pix) < pEnd || q < 0 || len(pix) < qEnd {
Expand Down