]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
buffer: make iterator copy to ptr handle len==0 11027/head
authorSage Weil <sage@redhat.com>
Thu, 29 Sep 2016 14:21:32 +0000 (10:21 -0400)
committerSage Weil <sage@redhat.com>
Sun, 16 Oct 2016 14:32:51 +0000 (10:32 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/common/buffer.cc

index 74a84a3b8cf772fa2095c40a4eb465f48b72762b..91b240fad737d26cb6ba229eb762cc0dfef824fd 100644 (file)
@@ -1163,6 +1163,9 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
   template<bool is_const>
   void buffer::list::iterator_impl<is_const>::copy_deep(unsigned len, ptr &dest)
   {
+    if (!len) {
+      return;
+    }
     if (p == ls->end())
       throw end_of_buffer();
     assert(p->length() > 0);
@@ -1173,6 +1176,9 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER;
   void buffer::list::iterator_impl<is_const>::copy_shallow(unsigned len,
                                                           ptr &dest)
   {
+    if (!len) {
+      return;
+    }
     if (p == ls->end())
       throw end_of_buffer();
     assert(p->length() > 0);