mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Fix int64_t overflow on file size when decoding content file
This commit is contained in:
parent
fa81c20ee6
commit
65e1eac061
1 changed files with 27 additions and 0 deletions
|
|
@ -2319,6 +2319,15 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* ensure the unsigned serialized size fits in signed data_off_t before conversion. */
|
||||
if (v_size > INT64_MAX) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal(ECONTENT, "Internal inconsistency: Invalid file size %" PRIu64 "!\n", v_size);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
if (state->block_size == 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
|
|
@ -2758,6 +2767,15 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* ensure the unsigned serialized size fits in signed data_off_t before conversion. */
|
||||
if (v_size > INT64_MAX) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal(ECONTENT, "Internal inconsistency: Invalid deallocated file size %" PRIu64 "!\n", v_size);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
ret = sgetb64(f, &v_mtime_sec);
|
||||
if (ret < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
|
|
@ -3360,6 +3378,15 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
|||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* ensure the unsigned serialized size fits in signed data_off_t before conversion. */
|
||||
if (v_size > INT64_MAX) {
|
||||
/* LCOV_EXCL_START */
|
||||
decoding_error(path, f);
|
||||
log_fatal(ECONTENT, "Internal inconsistency: Invalid split file size %" PRIu64 "!\n", v_size);
|
||||
exit(EXIT_FAILURE);
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
/* if we use this parity entry */
|
||||
if (v_level < state->level) {
|
||||
/* if this split was removed from the configuration */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue