mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-30 19:21:17 +00:00
fix segment entry header size check, attic issue #352
it only checked for too big sizes, but not for too small ones. that made it die with a ValueError and not raise the appropriate IntegrityError that gets handled in check() and triggers the repair attempt for the segment.
This commit is contained in:
parent
a3d967bdff
commit
6aca4694fe
1 changed files with 1 additions and 1 deletions
|
@ -538,7 +538,7 @@ def iter_objects(self, segment, include_data=False):
|
||||||
crc, size, tag = self.header_fmt.unpack(header)
|
crc, size, tag = self.header_fmt.unpack(header)
|
||||||
except struct.error as err:
|
except struct.error as err:
|
||||||
raise IntegrityError('Invalid segment entry header [offset {}]: {}'.format(offset, err))
|
raise IntegrityError('Invalid segment entry header [offset {}]: {}'.format(offset, err))
|
||||||
if size > MAX_OBJECT_SIZE:
|
if size > MAX_OBJECT_SIZE or size < self.header_fmt.size:
|
||||||
raise IntegrityError('Invalid segment entry size [offset {}]'.format(offset))
|
raise IntegrityError('Invalid segment entry size [offset {}]'.format(offset))
|
||||||
length = size - self.header_fmt.size
|
length = size - self.header_fmt.size
|
||||||
rest = fd.read(length)
|
rest = fd.read(length)
|
||||||
|
|
Loading…
Reference in a new issue