diff options
author | Zuul <zuul@review.opendev.org> | 2021-07-26 22:24:08 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-07-26 22:24:08 +0000 |
commit | 7b235691e9601d3e05a0cc7ee11bd35612a6cbc9 (patch) | |
tree | e32fbe805c80e09bdb2aebc6fef013c9f6acbd64 | |
parent | d1e129453b130b262b183e75af4687df4fdbe491 (diff) | |
parent | a7e1ddf685af09c9ad99dc2641067a846d8c88e8 (diff) | |
download | liberasurecode-7b235691e9601d3e05a0cc7ee11bd35612a6cbc9.tar.gz |
Merge "Fix underflow in flat_xor_hd code"
-rw-r--r-- | src/builtin/xor_codes/xor_hd_code.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/builtin/xor_codes/xor_hd_code.c b/src/builtin/xor_codes/xor_hd_code.c index 9e41ad1..ae9607a 100644 --- a/src/builtin/xor_codes/xor_hd_code.c +++ b/src/builtin/xor_codes/xor_hd_code.c @@ -155,19 +155,21 @@ static int fragments_needed_three_data(xor_code_t *code_desc, int *missing_data, remove_from_missing_list(data_index, missing_data); - // Include all data elements except for this one - *data_bm |= (code_desc->parity_bms[parity_index-code_desc->k]); - - // Include this parity element if (parity_index > -1) { + // Include this parity element *parity_bm |= (1 << (parity_index-code_desc->k)); + // Include all data elements except for this one + *data_bm |= code_desc->parity_bms[parity_index-code_desc->k]; } else { + // Include both parity elements *parity_bm |= (1 << (contains_2d-code_desc->k)); *parity_bm |= (1 << (contains_3d-code_desc->k)); + // And all other data elements that didn't cancel out + *data_bm |= tmp_parity_bm; } ret = fragments_needed_two_data(code_desc, missing_data, missing_parity, data_bm, parity_bm); - + *data_bm &= ~((unsigned int)1 << data_index); return ret; |