From e9c2ac02f1f59714677e3e1b984367df3c0ec166 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 1 Sep 2022 10:50:46 -0400 Subject: [PATCH] rgw: avoid string_view to temporary in RGWBulkUploadOp the `else` block below constructs a temporary std::string that destructs at the end of the statement, leaving `filename` as a dangling view: ``` filename = file_prefix + std::string(header->get_filename()); ``` store a copy of the `std::string` instead Fixes: https://tracker.ceph.com/issues/57326 Signed-off-by: Casey Bodley --- src/rgw/rgw_op.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 1c3ec52e3c13..e3af288417a6 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -7587,7 +7587,7 @@ void RGWBulkUploadOp::execute(optional_yield y) case rgw::tar::FileType::NORMAL_FILE: { ldpp_dout(this, 2) << "handling regular file" << dendl; - std::string_view filename; + std::string filename; if (bucket_path.empty()) filename = header->get_filename(); else -- 2.47.3