From 48acf79f05842afb8fd8b9e92001520c44368ae0 Mon Sep 17 00:00:00 2001 From: Ronit Sabhaya Date: Tue, 30 Dec 2025 15:46:55 -0600 Subject: [PATCH 1/2] Fix EXT4 extent offset double-counting causing block address overflow --- Sources/ContainerizationEXT4/EXT4+Formatter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ContainerizationEXT4/EXT4+Formatter.swift b/Sources/ContainerizationEXT4/EXT4+Formatter.swift index d73d1a8e..77a064fa 100644 --- a/Sources/ContainerizationEXT4/EXT4+Formatter.swift +++ b/Sources/ContainerizationEXT4/EXT4+Formatter.swift @@ -1135,7 +1135,7 @@ extension EXT4 { let offset = i * extentsPerBlock * EXT4.MaxBlocksPerExtent fillExtents( node: &leafNode, numExtents: extentsInBlock, numBlocks: dataBlocks, - start: blocks.start + offset, + start: blocks.start, //Fixed: removed '+ offset' to prevent double-counting offset: offset) try withUnsafeLittleEndianBytes(of: leafNode.header) { bytes in try self.handle.write(contentsOf: bytes) From 6811c56af2c4333d3c66f324d4283b1019d04f13 Mon Sep 17 00:00:00 2001 From: Ronit Sabhaya Date: Wed, 31 Dec 2025 12:11:47 -0600 Subject: [PATCH 2/2] removed the comments --- Sources/ContainerizationEXT4/EXT4+Formatter.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ContainerizationEXT4/EXT4+Formatter.swift b/Sources/ContainerizationEXT4/EXT4+Formatter.swift index 77a064fa..55efa9a8 100644 --- a/Sources/ContainerizationEXT4/EXT4+Formatter.swift +++ b/Sources/ContainerizationEXT4/EXT4+Formatter.swift @@ -1135,7 +1135,7 @@ extension EXT4 { let offset = i * extentsPerBlock * EXT4.MaxBlocksPerExtent fillExtents( node: &leafNode, numExtents: extentsInBlock, numBlocks: dataBlocks, - start: blocks.start, //Fixed: removed '+ offset' to prevent double-counting + start: blocks.start, offset: offset) try withUnsafeLittleEndianBytes(of: leafNode.header) { bytes in try self.handle.write(contentsOf: bytes)