mirror of
https://github.com/borgbackup/borg.git
synced 2026-02-28 20:41:14 -05:00
repo: split size check into too small and too big
also add a hint if somebody needs to restore an archive that has too big objects.
This commit is contained in:
parent
a360307938
commit
20392f8dd9
1 changed files with 8 additions and 3 deletions
|
|
@ -712,9 +712,14 @@ class LoggedIO:
|
|||
key = None
|
||||
else:
|
||||
raise TypeError("_read called with unsupported format")
|
||||
if size > MAX_OBJECT_SIZE or size < fmt.size:
|
||||
raise IntegrityError('Invalid segment entry size [segment {}, offset {}]'.format(
|
||||
segment, offset))
|
||||
if size > MAX_OBJECT_SIZE:
|
||||
# if you get this on an archive made with borg < 1.0.7 and millions of files and
|
||||
# you need to restore it, you can disable this check by using "if False:" above.
|
||||
raise IntegrityError('Invalid segment entry size {} - too big [segment {}, offset {}]'.format(
|
||||
size, segment, offset))
|
||||
if size < fmt.size:
|
||||
raise IntegrityError('Invalid segment entry size {} - too small [segment {}, offset {}]'.format(
|
||||
size, segment, offset))
|
||||
length = size - fmt.size
|
||||
data = fd.read(length)
|
||||
if len(data) != length:
|
||||
|
|
|
|||
Loading…
Reference in a new issue