libsparse: fix 32 bit overflow when calculating last chunk
last_block * s->block_size can overflow when writing large filesystems, cast to 64 bits before multiplying. Change-Id: I3e54097852ce7d0fd271eab53d65e666284898e4
This commit is contained in:
parent
ec7d9dc713
commit
f1ec8ac84a
1 changed files with 1 additions and 1 deletions
|
@ -139,7 +139,7 @@ static int write_all_blocks(struct sparse_file *s, struct output_file *out)
|
|||
DIV_ROUND_UP(backed_block_len(bb), s->block_size);
|
||||
}
|
||||
|
||||
pad = s->len - last_block * s->block_size;
|
||||
pad = s->len - (int64_t)last_block * s->block_size;
|
||||
assert(pad >= 0);
|
||||
if (pad > 0) {
|
||||
write_skip_chunk(out, pad);
|
||||
|
|
Loading…
Reference in a new issue