From: yuliyang Date: Mon, 20 May 2019 10:07:41 +0000 (+0800) Subject: rgw: fix rgw crash and set correct error code X-Git-Tag: v14.2.3~136^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=280a408a1fbf63641ef7c1a964618b216c29db40;p=ceph.git rgw: fix rgw crash and set correct error code Signed-off-by: yuliyang (cherry picked from commit fcbe09dae5c3c643492c58fb16bc705114138c63) --- diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc index 18ce9e917a1..335657ef081 100644 --- a/src/rgw/rgw_rest_s3.cc +++ b/src/rgw/rgw_rest_s3.cc @@ -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; }