]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit - lib/ext2fs/punch.c
libext2fs: clamp block-map punch range end to 2^32 blocks
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 15 Dec 2013 00:46:50 +0000 (19:46 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 15 Dec 2013 00:46:53 +0000 (19:46 -0500)
commit4c6fd9c20a3473db3fe419d613244e26c4a92b7b
tree50584bc671217f314902df41467eb477e9972a68
parent299cc61755f72311df002cc99dae13f469e0a198
libext2fs: clamp block-map punch range end to 2^32 blocks

In the ^extent case, passing ~0ULL as the 'end' parameter to
ext2fs_punch() causes the (end - start + 1) calculation to overflow to
zero.  Since the old-style mapped block files cannot have more than
2^32 blocks, just clamp it to ~0U.

This fixes a regression in t_quota_2off with the patch "libext2fs: use
ext2fs_punch() to truncate quota file" applied.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/punch.c