Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ Increment the:
a running request still belongs to
[#4396](https://github.com/open-telemetry/opentelemetry-cpp/issues/4396)

* [BUG] Compare the curl seek offset in `curl_off_t` before narrowing it to
`size_t`, so an offset past the `size_t` range cannot wrap back inside the
request body on a 32-bit build
[#4630](https://github.com/open-telemetry/opentelemetry-cpp/pull/4630)

## [1.29.0] 2026-09-13

* [RELEASE] Bump main branch to 1.29.0-dev (#4259)
Expand Down
3 changes: 2 additions & 1 deletion ext/src/http/client/curl/http_operation_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ int HttpOperation::SeekCallback(void *userp, curl_off_t offset, int origin)
// move of the read cursor. Anything else is refused rather than approximated, because reporting
// success without repositioning would resume the upload from the wrong offset and send a
// truncated or misaligned body.
if (origin != SEEK_SET || offset < 0 || static_cast<size_t>(offset) > self->request_body_.size())
if (origin != SEEK_SET || offset < 0 ||
offset > static_cast<curl_off_t>(self->request_body_.size()))
{
return CURL_SEEKFUNC_CANTSEEK;
}
Expand Down
8 changes: 8 additions & 0 deletions ext/test/http/curl_http_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <limits>
#include <map>
#include <memory>
#include <mutex>
Expand Down Expand Up @@ -537,6 +539,12 @@ TEST_F(BasicCurlHttpTests, SeekCallbackRepositionsTheRequestBody)
EXPECT_EQ(CURL_SEEKFUNC_CANTSEEK, Peer::Seek(operation, -1, SEEK_SET));
EXPECT_EQ(CURL_SEEKFUNC_CANTSEEK, Peer::Seek(operation, 0, SEEK_CUR));
EXPECT_EQ(CURL_SEEKFUNC_CANTSEEK, Peer::Seek(operation, 0, SEEK_END));

// An offset past the range of size_t must stay out of range. Narrowing it to size_t first
// wrapped it back into the body on a build where size_t is 32 bits.
EXPECT_EQ(CURL_SEEKFUNC_CANTSEEK,
Peer::Seek(operation, static_cast<curl_off_t>(std::numeric_limits<uint32_t>::max()) + 4,
SEEK_SET));
EXPECT_EQ(3u, Peer::ReadCursor(operation));

EXPECT_EQ(CURL_SEEKFUNC_CANTSEEK, Peer::SeekNullUserData(0, SEEK_SET));
Expand Down
Loading