diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index eb48f313..1e5f8a3b 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,9 @@ +2001-01-17 Theodore Ts'o + + * pass1.c (check_blocks): Fix large file checking code so that + files > 2GB are considered large files, and restrict + directories from being > 2GB. + 2001-01-12 Theodore Ts'o * journal.c (e2fsck_journal_fix_unsupported_super): Remove unused diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 19995320..99a88b09 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -923,8 +923,9 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx, } if (pb.is_dir) { int nblock = inode->i_size >> EXT2_BLOCK_SIZE_BITS(fs->super); - if ((nblock > (pb.last_block + 1)) || - ((inode->i_size & (fs->blocksize-1)) != 0)) + /* We don't let a directory become larger than 2GB */ + if (nblock > (pb.last_block + 1) || + (inode->i_size & ((fs->blocksize-1) | 0x80000000UL)) != 0) bad_size = 1; else if (nblock < (pb.last_block + 1)) { if (((pb.last_block + 1) - nblock) > @@ -932,11 +933,12 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx, bad_size = 2; } } else { - size = inode->i_size + ((__u64) inode->i_size_high << 32); + size = inode->i_size | ((__u64) inode->i_size_high << 32); if ((size < pb.last_block * fs->blocksize)) bad_size = 3; else if (size > ext2_max_sizes[fs->super->s_log_block_size]) bad_size = 4; + /* FIXME: need to ensure pb.num_blocks < 2^32 */ } if (bad_size) { pctx->num = (pb.last_block+1) * fs->blocksize; @@ -948,7 +950,7 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx, } pctx->num = 0; } - if (!pb.is_dir && inode->i_size_high) + if (!pb.is_dir && (inode->i_size_high || inode->i_size & 0x80000000UL)) ctx->large_files++; if (pb.num_blocks != inode->i_blocks) { pctx->num = pb.num_blocks; diff --git a/version.h b/version.h index fbee604e..320a3552 100644 --- a/version.h +++ b/version.h @@ -7,4 +7,4 @@ */ #define E2FSPROGS_VERSION "1.20-WIP" -#define E2FSPROGS_DATE "03-Jan-2001" +#define E2FSPROGS_DATE "17-Jan-2001"