]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rgw: test before accessing pkeys->rbegin() 28391/head
authorCasey Bodley <cbodley@redhat.com>
Tue, 4 Jun 2019 20:40:36 +0000 (16:40 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 4 Jun 2019 20:40:40 +0000 (16:40 -0400)
if pkeys is empty here, dereferencing rbegin() will crash

Fixes: http://tracker.ceph.com/issues/39984
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/cls/rgw/cls_rgw.cc

index 6c19d9fb13a6a95933c4b97981c6f08a8358c64d..8babb8a7faecb4396b609ae50947597d9e250e37 100644 (file)
@@ -176,7 +176,7 @@ static int get_obj_vals(cls_method_context_t hctx, const string& start, const st
   if (num_entries == (int)pkeys->size() || !(*pmore))
     return 0;
 
-  if (pkeys->rbegin()->first > new_start) {
+  if (pkeys->size() && new_start < pkeys->rbegin()->first) {
     new_start = pkeys->rbegin()->first;
   }