Skip to content

Commit

Permalink
fix Uvarint overflow. (see golang#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
amahov committed Jun 1, 2015
1 parent a911026 commit 432dca5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions snappy/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ func decodedLen(src []byte) (blockLen, headerLen int, err error) {
if n == 0 {
return 0, 0, ErrCorrupt
}
if n < 0 {
return 0, 0, errors.New("snappy: value larger than 64 bits (overflow)")
}
if uint64(int(v)) != v {
return 0, 0, errors.New("snappy: decoded block is too large")
}
Expand Down

0 comments on commit 432dca5

Please sign in to comment.