LU-7381 libext2fs: fix block-mapped file punch
If ext2fs_punch() was called with "end = ~0ULL" to indicate truncate
to the end of file it tried to compute "count" for ext2fs_punch_ind()
based on "start" and "end", but incorrectly passed "count = ~0U" even
when "start" was non-zero, causing an overflow in some cases.
The calling convention for ext2fs_punch_ind() was also gratuitously
different from ext2fs_punch() and ext2fs_punch_extent(), passing
"count" instead of "end" as the last parameter. Fix this by passing
it "end" like the other functions, and handle "count" internally.
Add checks to ext2fs_punch_ind() if "end" is at or beyond the 2^32
indirect block limit so the 32-bit internal variables don't overflow.
e2fsprogs-commit:
e158db537754ae1ffb3ec6184051bd1a4226937a
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Change-Id: Ifb8f76c2fbcc9f320dbbe7c1c2c329ce363ebbe5
Reviewed-on: http://review.whamcloud.com/17152
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>