summaryrefslogtreecommitdiff
path: root/vendor/github.com/klauspost/compress/huff0/compress.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-28 05:37:44 -0400
committerGitHub <noreply@github.com>2020-08-28 05:37:44 -0400
commitd6b13d8a0993aced5e227e7a516aadbf37e14dbc (patch)
tree276c3ffed36d0a12ba2ecce810edd5b831da8dec /vendor/github.com/klauspost/compress/huff0/compress.go
parenta38e77bbb56983a65419be375a25a336143759a3 (diff)
parent98ead36531378ea22d1298235a10ce476f20391d (diff)
downloadpodman-d6b13d8a0993aced5e227e7a516aadbf37e14dbc.tar.gz
podman-d6b13d8a0993aced5e227e7a516aadbf37e14dbc.tar.bz2
podman-d6b13d8a0993aced5e227e7a516aadbf37e14dbc.zip
Merge pull request #7480 from openSUSE/containers-common
Switch to containers/common for seccomp
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]
}