Fix an integer overflow when computing the size of a deleted entry

This bug prevented SnapRAID to read a valid content file, in case
a deleted entry bigger than 4 GB was present.
This could be reproduced deleting a file bigger than 4 GB and then sync.
This commit is contained in:
Andrea Mazzoleni 2015-11-18 23:02:21 +01:00
parent 9bd0f18439
commit 496611f476
2 changed files with 10 additions and 1 deletions

View file

@ -2012,7 +2012,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
/* if it's a run of deleted blocks */
/* allocate a fake deleted file */
deleted = file_alloc(state->block_size, "<deleted>", v_count * state->block_size, 0, 0, 0, 0);
deleted = file_alloc(state->block_size, "<deleted>", v_count * (data_off_t)state->block_size, 0, 0, 0, 0);
/* mark the file as deleted */
file_flag_set(deleted, FILE_IS_DELETED);