]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: catch possible exception
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 27 Sep 2012 21:58:12 +0000 (14:58 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Mon, 8 Oct 2012 22:11:16 +0000 (15:11 -0700)
Fix coverity issue 717168.

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

index 0114204f6ff22a43f18b3c73de0680f839b97fa0..9c136a8aad5ff0c6e53a6f84949533f7439bb638 100644 (file)
@@ -471,7 +471,11 @@ int RGWRados::log_show_next(RGWAccessHandle handle, rgw_log_entry *entry)
       return r;
     state->pos += r;
     bufferlist old;
-    old.substr_of(state->bl, off, state->bl.length() - off);
+    try {
+      old.substr_of(state->bl, off, state->bl.length() - off);
+    } catch (buffer::error& err) {
+      return -EINVAL;
+    }
     state->bl.clear();
     state->bl.claim(old);
     state->bl.claim_append(more);