summaryrefslogtreecommitdiff
path: root/src/erasurecode.c
diff options
context:
space:
mode:
authorKevin Greenan <kmg@box.com>2015-04-26 16:59:04 -0700
committerKevin Greenan <kmg@box.com>2015-04-27 11:59:21 -0700
commita01b1818c874a65d1d1fb8f11ea441e9d3e18771 (patch)
treee38c2ed6b776d578bc4f381d529aea4098b62ab4 /src/erasurecode.c
parenta380246762c16ea8eb7dbfccd50d296c3743b39e (diff)
downloadliberasurecode-a01b1818c874a65d1d1fb8f11ea441e9d3e18771.tar.gz
This is the fix for Issue #13:
https://bitbucket.org/tsg-/liberasurecode/issue/13/decode-fails-for-many-cases-when-m-k This fix includes: 1.) Proper buffer allocation for the 'missing_idxs' structure, which was not allocating enough space when k > m. 2.) Checks to use header fields of parity fragments during decode when *no* data fragments are available. 3.) Fixed the unit tests to properly handle the case where k <= m. 4.) Extended the unit test framework to support multiple tests per backend 5.) Added tests for all RS implementations: (4,8), (4,4), (10,10)
Diffstat (limited to 'src/erasurecode.c')
-rw-r--r--src/erasurecode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/erasurecode.c b/src/erasurecode.c
index 2c6a30b..d9a868c 100644
--- a/src/erasurecode.c
+++ b/src/erasurecode.c
@@ -587,7 +587,7 @@ int liberasurecode_decode(int desc,
goto out;
}
- missing_idxs = alloc_and_set_buffer(sizeof(char*) * k, -1);
+ missing_idxs = alloc_and_set_buffer(sizeof(char*) * (k + m), -1);
if (NULL == missing_idxs) {
log_error("Could not allocate missing_idxs buffer!");
goto out;
@@ -771,7 +771,7 @@ int liberasurecode_reconstruct_fragment(int desc,
goto out;
}
- missing_idxs = alloc_and_set_buffer(sizeof(int*) * k, -1);
+ missing_idxs = alloc_and_set_buffer(sizeof(int*) * (k + m), -1);
if (NULL == missing_idxs) {
log_error("Could not allocate missing_idxs buffer!");
goto out;