Skip to content

Commit

Permalink
pkgbuild: add ceph-17.2.5-rgw-client-boost-string-view.patch
Browse files Browse the repository at this point in the history
So long story short, boost 1.81 has fairly large breaking API changes,
as they migrated to use an internal string_view shim rather than
std::string_view, across the entire beast codebase. Therefore, we
remove any attempts to convert to std::string_view from
boost::core::string_view, as it implicitly handles conversions to
std::string where needed (like std::string_view).

Long story. boostorg/beast#2451 introduced a change in their string_view
type defs for beast, which ultimately removed the to_string() method
inherited from boost::string_view (which is different to boost::core),
effectively changing the type of most of the returned values in
rgw_asio_client.cc's header manipulation logic.

However, this new shim string_view implicitly converts to std::string,
which is needed by RGWEnv::set, hence our removal of the various
to_string()s scattered across the file.

Notably, RGWEnv::set is remarkably strict in its accepted values, so I
trust that if this compiles we have introduced a subtle use after free
vis-a-vis all these string_views flying around.

References: boostorg/beast#2451
References: https://github.com/ceph/ceph/blob/v17.2.5/src/rgw/rgw_asio_client.cc
References: boostorg/beast#2594 (comment)
References: https://github.com/ceph/ceph/blob/v17.2.5/src/rgw/rgw_env.cc#L22
  • Loading branch information
bazaah committed Mar 6, 2023
1 parent dd2565d commit 5bc29e5
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions ceph-17.2.5-rgw-client-boost-string-view.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
diff --git a/src/rgw/rgw_asio_client.cc b/src/rgw/rgw_asio_client.cc
index 82d5d43f8b8..ad6723a6436 100644
--- a/src/rgw/rgw_asio_client.cc
+++ b/src/rgw/rgw_asio_client.cc
@@ -39,11 +39,11 @@ int ClientIO::init_env(CephContext *cct)
const auto& value = header->value();

if (field == beast::http::field::content_length) {
- env.set("CONTENT_LENGTH", value.to_string());
+ env.set("CONTENT_LENGTH", value);
continue;
}
if (field == beast::http::field::content_type) {
- env.set("CONTENT_TYPE", value.to_string());
+ env.set("CONTENT_TYPE", value);
continue;
}

@@ -62,26 +62,26 @@ int ClientIO::init_env(CephContext *cct)
}
*dest = '\0';

- env.set(buf, value.to_string());
+ env.set(buf, value);
}

int major = request.version() / 10;
int minor = request.version() % 10;
env.set("HTTP_VERSION", std::to_string(major) + '.' + std::to_string(minor));

- env.set("REQUEST_METHOD", request.method_string().to_string());
+ env.set("REQUEST_METHOD", request.method_string());

// split uri from query
auto uri = request.target();
auto pos = uri.find('?');
if (pos != uri.npos) {
auto query = uri.substr(pos + 1);
- env.set("QUERY_STRING", query.to_string());
+ env.set("QUERY_STRING", query);
uri = uri.substr(0, pos);
}
- env.set("SCRIPT_URI", uri.to_string());
+ env.set("SCRIPT_URI", uri);

- env.set("REQUEST_URI", request.target().to_string());
+ env.set("REQUEST_URI", request.target());

char port_buf[16];
snprintf(port_buf, sizeof(port_buf), "%d", local_endpoint.port());

0 comments on commit 5bc29e5

Please sign in to comment.