]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/CrushCompiler: Fix __replacement_assert
authorBrad Hubbard <bhubbard@redhat.com>
Thu, 11 Apr 2019 05:00:25 +0000 (15:00 +1000)
committerBrad Hubbard <bhubbard@redhat.com>
Thu, 11 Apr 2019 05:00:25 +0000 (15:00 +1000)
When compiled with _GLIBCXX_ASSERTIONS we see an assert due to UB of
passing the address of an empty vector. Use vector's data member
function instead of address of array syntax.

Fixes: http://tracker.ceph.com/issues/39174
Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
src/crush/CrushCompiler.cc

index 811852e25b30f9bd5c106e176b50da400f298432..d9a0e26b32f038e2e918e96080413807ec801a43 100644 (file)
@@ -751,7 +751,7 @@ int CrushCompiler::parse_bucket(iter_t const& i)
   ceph_assert(id != 0);
   int idout;
   int r = crush.add_bucket(id, alg, hash, type, size,
-                           &items[0], &weights[0], &idout);
+                           items.data(), weights.data(), &idout);
   if (r < 0) {
     if (r == -EEXIST)
       err << "Duplicate bucket id " << id << std::endl;