From: Guang G Yang Date: Tue, 28 Jul 2015 16:25:53 +0000 (+0000) Subject: osd: check the length of the map before accessing the first element X-Git-Tag: v9.1.0~182^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cabfe137817bebda13bd31b9e09267d0778e5968;p=ceph.git osd: check the length of the map before accessing the first element Signed-off-by: Guang Yang yguang@yahoo-inc.com --- diff --git a/src/osd/ECUtil.cc b/src/osd/ECUtil.cc index 9d2c2fb261e9..46a16c379fb4 100644 --- a/src/osd/ECUtil.cc +++ b/src/osd/ECUtil.cc @@ -9,11 +9,11 @@ int ECUtil::decode( ErasureCodeInterfaceRef &ec_impl, map &to_decode, bufferlist *out) { + assert(to_decode.size()); uint64_t total_data_size = to_decode.begin()->second.length(); - - assert(to_decode.size()); assert(total_data_size % sinfo.get_chunk_size() == 0); + assert(out); assert(out->length() == 0); @@ -47,10 +47,9 @@ int ECUtil::decode( ErasureCodeInterfaceRef &ec_impl, map &to_decode, map &out) { + assert(to_decode.size()); uint64_t total_data_size = to_decode.begin()->second.length(); - - assert(to_decode.size()); assert(total_data_size % sinfo.get_chunk_size() == 0); for (map::iterator i = to_decode.begin();