mirror of
https://github.com/vbatts/tar-split.git
synced 2025-07-03 06:48:29 +00:00
archive/tar: terminate when reading malformed sparse files
Fixes #10968. Change-Id: I027bc571a71629ac49c2a0ff101b2950af6e7531 Reviewed-on: https://go-review.googlesource.com/10482 Reviewed-by: David Symonds <dsymonds@golang.org> Run-TryBot: David Symonds <dsymonds@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
576b273762
commit
55dceefe42
3 changed files with 22 additions and 0 deletions
|
@ -899,6 +899,9 @@ func (sfr *sparseFileReader) Read(b []byte) (n int, err error) {
|
|||
// Otherwise, we're at the end of the file
|
||||
return 0, io.EOF
|
||||
}
|
||||
if sfr.tot < sfr.sp[0].offset {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
if sfr.pos < sfr.sp[0].offset {
|
||||
// We're in a hole
|
||||
n = sfr.readHole(b, sfr.sp[0].offset)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue