]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: don't try to read beyong object size
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 25 Oct 2018 22:32:16 +0000 (15:32 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 4 Jan 2019 03:00:22 +0000 (19:00 -0800)
Otherwise even if we prefetch all the data, we'd try to issue another
request to read the rest of the object.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc

index 819c957c90088c3a6107b7ea56ee21cae3dd2fc6..9e7f82733da30cbe727ca1900a78c30d23771bc0 100644 (file)
@@ -6481,6 +6481,12 @@ int RGWRados::Object::Read::read(int64_t ofs, int64_t end, bufferlist& bl)
   if (r < 0)
     return r;
 
+  if (astate->size == 0) {
+    end = 0;
+  } else if (end >= (int64_t)astate->size) {
+    end = astate->size - 1;
+  }
+
   if (end < 0)
     len = 0;
   else