FILO: Check overflow when converting unsigned to signed
diff --git a/src/filo-fs.adb b/src/filo-fs.adb
index ab2b9c8..69ed2ad 100644
--- a/src/filo-fs.adb
+++ b/src/filo-fs.adb
@@ -18,7 +18,10 @@
Convention => C,
External_Name => "filepos";
- function Part_Len return Partition_Length is (Partition_Length (C_Part_Length));
+ function Part_Len return Partition_Length
+ is
+ (Partition_Length (unsigned_long'Min (
+ C_Part_Length, unsigned_long (Partition_Length'Last))));
function File_Max return File_Length is
begin