ext2: Restrict range of First_Data_Block
diff --git a/src/filo-fs-ext2.adb b/src/filo-fs-ext2.adb
index c7ea867..0d3df60 100644
--- a/src/filo-fs-ext2.adb
+++ b/src/filo-fs-ext2.adb
@@ -58,7 +58,7 @@
end if;
Static.Part_Len := Part_Len;
- Static.First_Data_Block := FSBlock_Offset (Read_LE32 (Super_Block, 5 * 4));
+ Static.First_Data_Block := Read_LE32 (Super_Block, 5 * 4);
declare
S_Log_Block_Size : constant Unsigned_32 := Read_LE32 (Super_Block, 6 * 4);
@@ -678,7 +678,7 @@
Group : constant Group_Index := Group_Index ((Inode - 1) / Static.Inodes_Per_Group);
Desc_Block : constant FSBlock_Offset :=
- 1 + Static.First_Data_Block + FSBlock_Offset (Group / Static.Desc_Per_Block);
+ 1 + FSBlock_Offset (Static.First_Data_Block) + FSBlock_Offset (Group / Static.Desc_Per_Block);
Cache_Start, Cache_End : Max_Block_Index;
begin
Cache_FSBlock
diff --git a/src/filo-fs-ext2.ads b/src/filo-fs-ext2.ads
index 5537507..bbf959b 100644
--- a/src/filo-fs-ext2.ads
+++ b/src/filo-fs-ext2.ads
@@ -98,7 +98,7 @@
type Mount_State is record
Part_Len : Partition_Length := 0;
- First_Data_Block : FSBlock_Offset := 0;
+ First_Data_Block : Unsigned_32 := Unsigned_32'First;
Block_Size_Bits : Log_Block_Size := Log_Block_Size'First;
Block_Size : Ext2.Block_Size := Ext2.Block_Size'First;
Inodes_Per_Group : Inode_Index := Inode_Index'First;