]> git-server-git.apps.pok.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)
committerPrashant D <pdhange@redhat.com>
Tue, 7 May 2019 02:23:37 +0000 (22:23 -0400)
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>
(cherry picked from commit a950ac230ec900c53fa74f46c18f86a459c80831)

src/crush/CrushCompiler.cc

index a6a67c65885f8e5044285deb562e366e1a2034ad..0fe9a746cb3ab57f4eab8c3204f1407a98e478fb 100644 (file)
@@ -744,7 +744,7 @@ int CrushCompiler::parse_bucket(iter_t const& i)
   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;