]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: check the length of the map before accessing the first element 5779/head
authorGuang G Yang <yguang@renownedground.corp.gq1.yahoo.com>
Tue, 28 Jul 2015 16:25:53 +0000 (16:25 +0000)
committerDavid Zafman <dzafman@redhat.com>
Wed, 2 Sep 2015 17:04:30 +0000 (10:04 -0700)
Signed-off-by: Guang Yang yguang@yahoo-inc.com
src/osd/ECUtil.cc

index 9d2c2fb261e9d4e860f2af14ae76078a74e60ea9..46a16c379fb43f2dfbd10b045d579c59d1fee8b9 100644 (file)
@@ -9,11 +9,11 @@ int ECUtil::decode(
   ErasureCodeInterfaceRef &ec_impl,
   map<int, bufferlist> &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<int, bufferlist> &to_decode,
   map<int, 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);
 
   for (map<int, bufferlist>::iterator i = to_decode.begin();