Skip to content

Commit

Permalink
Fix 32 bit builds (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
klauspost committed Jun 17, 2019
1 parent 0b31f26 commit 4dbb2ac
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ script:
- go test -cpu=2 -tags=noasm ./...
- go test -cpu=1,2,4 -short -race ./...
- go test -cpu=2,4 -short -race -tags=noasm ./...
- GOOS=linux GOARCH=386 go install ./...

matrix:
allow_failures:
Expand Down
2 changes: 1 addition & 1 deletion fse/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Compress(in []byte, s *Scratch) ([]byte, error) {
if len(in) <= 1 {
return nil, ErrIncompressible
}
if len(in) >= 2<<30 {
if len(in) > (2<<30)-1 {
return nil, errors.New("input too big, must be < 2GB")
}
s, err := s.prepare(in)
Expand Down
2 changes: 1 addition & 1 deletion fse/fse.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (s *Scratch) prepare(in []byte) (*Scratch, error) {
s.br.init(in)
if s.DecompressLimit == 0 {
// Max size 2GB.
s.DecompressLimit = 2 << 30
s.DecompressLimit = (2 << 30) - 1
}

return s, nil
Expand Down
2 changes: 1 addition & 1 deletion zstd/frameenc.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func skippableFrame(dst []byte, total int, r io.Reader) ([]byte, error) {
if total < skippableFrameHeader {
return dst, fmt.Errorf("requested skippable frame (%d) < 8", total)
}
if total > math.MaxUint32 {
if int64(total) > math.MaxUint32 {
return dst, fmt.Errorf("requested skippable frame (%d) > max uint32", total)
}
dst = append(dst, 0x50, 0x2a, 0x4d, 0x18)
Expand Down

0 comments on commit 4dbb2ac

Please sign in to comment.