[ext2fs] check for the maximum ext2/ext3 volume size

* Suggested by Marcos Mello
* Closes #1524
This commit is contained in:
Pete Batard 2020-04-28 18:34:45 +01:00
parent 8a59238022
commit 083b3db34c
No known key found for this signature in database
GPG Key ID: 38E0CF5E69EDD671
2 changed files with 13 additions and 5 deletions

View File

@ -312,6 +312,14 @@ BOOL FormatExtFs(DWORD DriveIndex, uint64_t PartitionOffset, DWORD BlockSize, LP
features.s_log_cluster_size = features.s_log_block_size;
size /= BlockSize;
// ext2 and ext3 have a can only accomodate up to Blocksize * 2^32 sized volumes
if (((strcmp(FSName, FileSystemLabel[FS_EXT2]) == 0) || (strcmp(FSName, FileSystemLabel[FS_EXT3]) == 0)) &&
(size >= 0x100000000ULL)) {
FormatStatus = ext2_last_winerror(ERROR_INVALID_VOLUME_SIZE);
uprintf("Volume size is too large for ext2 or ext3");
goto out;
}
// Set the blocks, reserved blocks and inodes
ext2fs_blocks_count_set(&features, size);
ext2fs_r_blocks_count_set(&features, (blk64_t)(reserve_ratio * size));

View File

@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDD_DIALOG DIALOGEX 12, 12, 232, 326
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_ACCEPTFILES
CAPTION "Rufus 3.10.1650"
CAPTION "Rufus 3.10.1651"
FONT 9, "Segoe UI Symbol", 400, 0, 0x0
BEGIN
LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP
@ -395,8 +395,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,10,1650,0
PRODUCTVERSION 3,10,1650,0
FILEVERSION 3,10,1651,0
PRODUCTVERSION 3,10,1651,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -414,13 +414,13 @@ BEGIN
VALUE "Comments", "https://rufus.ie"
VALUE "CompanyName", "Akeo Consulting"
VALUE "FileDescription", "Rufus"
VALUE "FileVersion", "3.10.1650"
VALUE "FileVersion", "3.10.1651"
VALUE "InternalName", "Rufus"
VALUE "LegalCopyright", "© 2011-2020 Pete Batard (GPL v3)"
VALUE "LegalTrademarks", "https://www.gnu.org/licenses/gpl-3.0.html"
VALUE "OriginalFilename", "rufus-3.10.exe"
VALUE "ProductName", "Rufus"
VALUE "ProductVersion", "3.10.1650"
VALUE "ProductVersion", "3.10.1651"
END
END
BLOCK "VarFileInfo"