| ... | ... | @@ -1457,7 +1457,10 @@ pub const Dir = struct { |
| 1457 | 1457 | var file = try self.openFile(file_path, .{}); |
| 1458 | 1458 | defer file.close(); |
| 1459 | 1459 | |
| 1460 | | const stat_size = size_hint orelse try file.getEndPos(); |
| 1460 | // If the file size doesn't fit a usize it'll be certainly greater than |
| 1461 | // `max_bytes` |
| 1462 | const stat_size = size_hint orelse math.cast(usize, try file.getEndPos()) catch |
| 1463 | return error.FileTooBig; |
| 1461 | 1464 | |
| 1462 | 1465 | return file.readToEndAllocOptions(allocator, max_bytes, stat_size, alignment, optional_sentinel); |
| 1463 | 1466 | } |