summaryrefslogtreecommitdiff
path: root/vendor/github.com/klauspost/compress/huff0/compress.go
diff options
context:
space:
mode:
authorSascha Grunert <sgrunert@suse.com>2020-08-27 21:14:55 +0200
committerSascha Grunert <sgrunert@suse.com>2020-08-27 21:14:59 +0200
commit98ead36531378ea22d1298235a10ce476f20391d (patch)
tree59c898ae69ab9f5d13e255f2575200f1329e003e /vendor/github.com/klauspost/compress/huff0/compress.go
parent72c5b35ea5db44ca1c81a688d90f5c3aa8f8262e (diff)
downloadpodman-98ead36531378ea22d1298235a10ce476f20391d.tar.gz
podman-98ead36531378ea22d1298235a10ce476f20391d.tar.bz2
podman-98ead36531378ea22d1298235a10ce476f20391d.zip
Switch to containers/common for seccomp
The seccomp/containers-golang library is not maintained any more and we should stick to containers/common. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
Diffstat (limited to 'vendor/github.com/klauspost/compress/huff0/compress.go')
-rw-r--r--vendor/github.com/klauspost/compress/huff0/compress.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/vendor/github.com/klauspost/compress/huff0/compress.go b/vendor/github.com/klauspost/compress/huff0/compress.go
index 0843cb014..f9ed5f830 100644
--- a/vendor/github.com/klauspost/compress/huff0/compress.go
+++ b/vendor/github.com/klauspost/compress/huff0/compress.go
@@ -77,8 +77,11 @@ func compress(in []byte, s *Scratch, compressor func(src []byte) ([]byte, error)
// Each symbol present maximum once or too well distributed.
return nil, false, ErrIncompressible
}
-
- if s.Reuse == ReusePolicyPrefer && canReuse {
+ if s.Reuse == ReusePolicyMust && !canReuse {
+ // We must reuse, but we can't.
+ return nil, false, ErrIncompressible
+ }
+ if (s.Reuse == ReusePolicyPrefer || s.Reuse == ReusePolicyMust) && canReuse {
keepTable := s.cTable
keepTL := s.actualTableLog
s.cTable = s.prevTable
@@ -90,6 +93,9 @@ func compress(in []byte, s *Scratch, compressor func(src []byte) ([]byte, error)
s.OutData = s.Out
return s.Out, true, nil
}
+ if s.Reuse == ReusePolicyMust {
+ return nil, false, ErrIncompressible
+ }
// Do not attempt to re-use later.
s.prevTable = s.prevTable[:0]
}