]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: fix rgw crash and set correct error code
authoryuliyang <yuliyang@cmss.chinamobile.com>
Mon, 20 May 2019 10:07:41 +0000 (18:07 +0800)
committeryuliyang <yuliyang@cmss.chinamobile.com>
Tue, 21 May 2019 01:15:06 +0000 (09:15 +0800)
Signed-off-by: yuliyang <yuliyang@cmss.chinamobile.com>
src/rgw/rgw_rest_s3.cc

index 424f42f87f06bc65e3a9ea38ca86b8967c957a96..1a90e8d47e415ef9120b1130f14e7413a6cfa829 100644 (file)
@@ -4477,9 +4477,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;
 }