mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 21:00:16 -05:00
Fix integer overflow in deleted block count byte size conversion in content parser
This commit is contained in:
parent
39e810564f
commit
b5cc5eb007
1 changed files with 9 additions and 0 deletions
|
|
@ -2677,6 +2677,15 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
||||||
case 'o' :
|
case 'o' :
|
||||||
/* if it's a run of deleted blocks */
|
/* if it's a run of deleted blocks */
|
||||||
|
|
||||||
|
/* ensure the converted byte size fits in signed data_off_t without overflow */
|
||||||
|
if (v_count > INT64_MAX / (uint64_t)state->block_size) {
|
||||||
|
/* LCOV_EXCL_START */
|
||||||
|
decoding_error(path, f);
|
||||||
|
log_fatal(ECONTENT, "Internal inconsistency: Invalid deleted block count %" PRIu64 "!\n", v_count);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
/* LCOV_EXCL_STOP */
|
||||||
|
}
|
||||||
|
|
||||||
/* allocate a fake deleted file */
|
/* allocate a fake deleted file */
|
||||||
deleted = file_alloc(state->block_size, "<deleted>", v_count * (data_off_t)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);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue