浏览代码

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.
Thomas Waldmann 9 年之前
父节点
当前提交
6aca4694fe
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      borg/repository.py

+ 1 - 1
borg/repository.py

@@ -538,7 +538,7 @@ class LoggedIO:
                 crc, size, tag = self.header_fmt.unpack(header)
             except struct.error as 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))
             length = size - self.header_fmt.size
             rest = fd.read(length)