From: Sage Weil Date: Thu, 29 Sep 2016 14:21:32 +0000 (-0400) Subject: buffer: make iterator copy to ptr handle len==0 X-Git-Tag: v11.1.0~617^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F11027%2Fhead;p=ceph.git buffer: make iterator copy to ptr handle len==0 Signed-off-by: Sage Weil --- diff --git a/src/common/buffer.cc b/src/common/buffer.cc index 74a84a3b8cf7..91b240fad737 100644 --- a/src/common/buffer.cc +++ b/src/common/buffer.cc @@ -1163,6 +1163,9 @@ static simple_spinlock_t buffer_debug_lock = SIMPLE_SPINLOCK_INITIALIZER; template void buffer::list::iterator_impl::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::copy_shallow(unsigned len, ptr &dest) { + if (!len) { + return; + } if (p == ls->end()) throw end_of_buffer(); assert(p->length() > 0);