Skip to content

Commit dc6e063

Browse files
committed
fix(models): adapt chunk's contains() definition.
We were considering that a chunk A contains a chunk B if chunk B start after chunk A and ends before or on the same offset than chunk A. This caused issues with compressed DMG images where two handlers would rightfully identify two chunks: - a bzip chunk starting at offset 0 and ending before the DMG plist - a DMG chunk starting at offset 0 and ending after the DMG footer We therefore adapted our definition of contains() where a contained chunk can start at the same offset but ends before, or start after the containing chunk but can end on the same offset.
1 parent 0dc4bb5 commit dc6e063

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

unblob/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ def contains(self, other: "Chunk") -> bool:
8787
return (
8888
self.start_offset < other.start_offset
8989
and self.end_offset >= other.end_offset
90+
) or (
91+
self.start_offset <= other.start_offset
92+
and self.end_offset > other.end_offset
9093
)
9194

9295
def contains_offset(self, offset: int) -> bool:

0 commit comments

Comments
 (0)