summaryrefslogtreecommitdiff
path: root/vendor/github.com/ulikunitz/xz/format.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-03-26 11:23:46 -0400
committerMatthew Heon <mheon@redhat.com>2021-03-29 11:06:03 -0400
commite7dc66d832d44eac11cb341f09844850e3e0224d (patch)
treee836a3d9a5ff60c9019e3daf2601d3c922af2a38 /vendor/github.com/ulikunitz/xz/format.go
parent57e0d8f2930690de69c690c41e30abaa2cdb3776 (diff)
downloadpodman-e7dc66d832d44eac11cb341f09844850e3e0224d.tar.gz
podman-e7dc66d832d44eac11cb341f09844850e3e0224d.tar.bz2
podman-e7dc66d832d44eac11cb341f09844850e3e0224d.zip
[NO TESTS NEEDED] Vendor in containers/buildah v1.20.0
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> <MH: Fixed cherry-pick conflicts. Re-ran vendor.> Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'vendor/github.com/ulikunitz/xz/format.go')
-rw-r--r--vendor/github.com/ulikunitz/xz/format.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/vendor/github.com/ulikunitz/xz/format.go b/vendor/github.com/ulikunitz/xz/format.go
index 84b58c9dd..c98c12dfd 100644
--- a/vendor/github.com/ulikunitz/xz/format.go
+++ b/vendor/github.com/ulikunitz/xz/format.go
@@ -1,4 +1,4 @@
-// Copyright 2014-2019 Ulrich Kunitz. All rights reserved.
+// Copyright 2014-2021 Ulrich Kunitz. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
@@ -662,7 +662,7 @@ func writeIndex(w io.Writer, index []record) (n int64, err error) {
// readIndexBody reads the index from the reader. It assumes that the
// index indicator has already been read.
-func readIndexBody(r io.Reader) (records []record, n int64, err error) {
+func readIndexBody(r io.Reader, expectedRecordLen int) (records []record, n int64, err error) {
crc := crc32.NewIEEE()
// index indicator
crc.Write([]byte{0})
@@ -679,6 +679,11 @@ func readIndexBody(r io.Reader) (records []record, n int64, err error) {
if recLen < 0 || uint64(recLen) != u {
return nil, n, errors.New("xz: record number overflow")
}
+ if recLen != expectedRecordLen {
+ return nil, n, fmt.Errorf(
+ "xz: index length is %d; want %d",
+ recLen, expectedRecordLen)
+ }
// list of records
records = make([]record, recLen)