diff options
author | Kota Tsuyuzaki <bloodeagle40234@gmail.com> | 2016-02-11 20:33:12 -0800 |
---|---|---|
committer | Kota Tsuyuzaki <bloodeagle40234@gmail.com> | 2016-02-11 20:33:12 -0800 |
commit | 6507f6b3f491dcd14cc97295b36bdff47e8b4d9f (patch) | |
tree | b7b44191aa8847f1096521c4b6f404ea819d371d | |
parent | 25fd05f0e9b589021ca3ac8c8bb425fe74386e20 (diff) | |
download | liberasurecode-corrupted-header.tar.gz |
Fix segmentation fault if frag header corruptedcorrupted-header
If the fragment header corrupted (I didn't dig it though),
it will cause segmentation error which can not be handled
in decoding process.
To prevent such an unfortunate situation, this patch makes
liberasurecode to skip the decoding and to return an error
status.
-rw-r--r-- | src/erasurecode.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/erasurecode.c b/src/erasurecode.c index 2d6d293..7f47149 100644 --- a/src/erasurecode.c +++ b/src/erasurecode.c @@ -581,6 +581,14 @@ int liberasurecode_decode(int desc, /* We were able to get the original data without decoding! */ goto out; } + if (ret == -EBADHEADER){ + /* currently, if the header of incomming fragments data corrupted, + * it may cause segmentaion fault during decoding process. + * Though, it might be good to determine if we can decode (or not) from + * the fragments but, for now, skip to decode and raise an error for this + * for safety */ + goto out; + } } /* |