summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTushar Gohad <tusharsg@gmail.com>2016-02-14 07:10:37 +0000
committerTushar Gohad <tusharsg@gmail.com>2016-02-14 07:14:43 +0000
commitc3ba38d1b2b237033a33f403c470674200133062 (patch)
tree45baf34267e815de1f2d05b7df63a182b2c17192
parent25fd05f0e9b589021ca3ac8c8bb425fe74386e20 (diff)
downloadliberasurecode-c3ba38d1b2b237033a33f403c470674200133062.tar.gz
Fix segfault when fragment index is out of range
... (in a corrupt/invalid fragment scenario) Fixes issue #21
-rw-r--r--src/erasurecode_preprocessing.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/erasurecode_preprocessing.c b/src/erasurecode_preprocessing.c
index 64c7edd..8492184 100644
--- a/src/erasurecode_preprocessing.c
+++ b/src/erasurecode_preprocessing.c
@@ -240,7 +240,7 @@ int get_fragment_partition(
*/
for (i = 0; i < num_fragments; i++) {
index = get_fragment_idx(fragments[i]);
- if (index < 0){
+ if (index < 0 || index > (k + m)) {
return -EBADHEADER;
}
if (index < k) {