diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-05-02 17:16:10 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-05-02 17:16:10 -0400 |
commit | e247f02a4fbf3997e4ff01eecf30ac1002e993af (patch) | |
tree | 2d287c16b9a80f888074af6b6118625d74da6a16 /vendor/github.com/klauspost/compress/zstd/decoder.go | |
parent | 3ac5cec086e1ee1f11fabfd8a8f0aa8cf9f371f5 (diff) | |
download | podman-e247f02a4fbf3997e4ff01eecf30ac1002e993af.tar.gz podman-e247f02a4fbf3997e4ff01eecf30ac1002e993af.tar.bz2 podman-e247f02a4fbf3997e4ff01eecf30ac1002e993af.zip |
Vendor in containers/(common, storage, image)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/klauspost/compress/zstd/decoder.go')
-rw-r--r-- | vendor/github.com/klauspost/compress/zstd/decoder.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/vendor/github.com/klauspost/compress/zstd/decoder.go b/vendor/github.com/klauspost/compress/zstd/decoder.go index 9fcdaac1d..c65ea9795 100644 --- a/vendor/github.com/klauspost/compress/zstd/decoder.go +++ b/vendor/github.com/klauspost/compress/zstd/decoder.go @@ -347,18 +347,20 @@ func (d *Decoder) DecodeAll(input, dst []byte) ([]byte, error) { } frame.history.setDict(&dict) } - - if frame.FrameContentSize != fcsUnknown && frame.FrameContentSize > d.o.maxDecodedSize-uint64(len(dst)) { - return dst, ErrDecoderSizeExceeded + if frame.WindowSize > d.o.maxWindowSize { + return dst, ErrWindowSizeExceeded } - if frame.FrameContentSize < 1<<30 { - // Never preallocate more than 1 GB up front. + if frame.FrameContentSize != fcsUnknown { + if frame.FrameContentSize > d.o.maxDecodedSize-uint64(len(dst)) { + return dst, ErrDecoderSizeExceeded + } if cap(dst)-len(dst) < int(frame.FrameContentSize) { - dst2 := make([]byte, len(dst), len(dst)+int(frame.FrameContentSize)) + dst2 := make([]byte, len(dst), len(dst)+int(frame.FrameContentSize)+compressedBlockOverAlloc) copy(dst2, dst) dst = dst2 } } + if cap(dst) == 0 { // Allocate len(input) * 2 by default if nothing is provided // and we didn't get frame content size. |