summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTushar Gohad <tusharsg@gmail.com>2015-03-30 19:12:41 -0700
committerTushar Gohad <tusharsg@gmail.com>2015-03-30 19:12:41 -0700
commit1c85fcfca65f6f38a8fdf05ba94c9988e91c52db (patch)
treec29bc548c3c33f31de64b36cd6d67665c651ff60 /src
parent497a0d8425a1e9afba265520765e87c2ece7935d (diff)
parent3c4ff134cb9c7f4fa84140b60c7f50cda5c4bbd4 (diff)
downloadliberasurecode-1c85fcfca65f6f38a8fdf05ba94c9988e91c52db.tar.gz
Merged in fix-metadata-check (pull request #13)
fix-metadata-check from Kota
Diffstat (limited to 'src')
-rw-r--r--src/erasurecode.c5
-rw-r--r--src/erasurecode_preprocessing.c3
2 files changed, 4 insertions, 4 deletions
diff --git a/src/erasurecode.c b/src/erasurecode.c
index 1544ab7..2c6a30b 100644
--- a/src/erasurecode.c
+++ b/src/erasurecode.c
@@ -566,10 +566,7 @@ int liberasurecode_decode(int desc,
available_fragments, num_fragments,
out_data, out_data_len);
- if (ret == -1) {
- /* Ignore - not necessarily an error
- * (see fragments_to_string() in src/erasurecode_preprocessing.c) */
- } else if (ret <= 0) {
+ if (ret == 0) {
/* We were able to get the original data without decoding! */
goto out;
}
diff --git a/src/erasurecode_preprocessing.c b/src/erasurecode_preprocessing.c
index a9a7b55..d8da1f6 100644
--- a/src/erasurecode_preprocessing.c
+++ b/src/erasurecode_preprocessing.c
@@ -224,6 +224,9 @@ int get_fragment_partition(
*/
for (i = 0; i < num_fragments; i++) {
index = get_fragment_idx(fragments[i]);
+ if (index < 0){
+ return -EBADHEADER;
+ }
if (index < k) {
data[index] = fragments[i];
} else {