]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix rgw crash and set correct error code 28729/head
authoryuliyang <yuliyang@cmss.chinamobile.com>
Mon, 20 May 2019 10:07:41 +0000 (18:07 +0800)
committeryuliyang <yuliyang@cmss.chinamobile.com>
Tue, 25 Jun 2019 01:14:17 +0000 (09:14 +0800)
Signed-off-by: yuliyang <yuliyang@cmss.chinamobile.com>
(cherry picked from commit fcbe09dae5c3c643492c58fb16bc705114138c63)

src/rgw/rgw_rest_s3.cc

index 18ce9e917a1e06f7ac2928b2c6b88e1240462454..335657ef081f6eeedb111ef778b2e2b3d7420f17 100644 (file)
@@ -4504,9 +4504,14 @@ rgw::auth::s3::STSEngine::get_session_token(const boost::string_view& session_to
     ldout(cct, 0) << "ERROR: Decryption failed: " << error << dendl;
     return -EPERM;
   } else {
-    dec_output.append('\0');
-    auto iter = dec_output.cbegin();
-    decode(token, iter);
+    try {
+      dec_output.append('\0');
+      auto iter = dec_output.cbegin();
+      decode(token, iter);
+    } catch (const buffer::error& e) {
+      ldout(cct, 0) << "ERROR: decode SessionToken failed: " << error << dendl;
+      return -EINVAL;
+    }
   }
   return 0;
 }