thrift: multiple CVE fixes
cover thrift: multiple CVE fixes
From: Adarsh Jagadish Kamini <[email protected]>
Backport upstream fixes for four CVEs in thrift 0.22.0:
- CVE-2026-55971: OOB read in the C++ THeaderTransport zlib untransform path.
- CVE-2026-58023: heap over-read in the c_glib buffered/framed transports.
- CVE-2026-48144: missing peer hostname validation in the c_glib TLS client.
- CVE-2026-58389: max_string_size not enforced on non-strict binary message names (Rust).
Tested on qemux86-64 by building with BUILD_TESTING=ON:
- CVE-2026-55971: new test_theadertransport_zlib_roundtrip passed.
- CVE-2026-58023: new ReadAcrossBuffer and ReadAcrossFrames tests passed, and fail without the fix.
CVE-2026-48144 ships no test; CVE-2026-58389 is in the Rust library, which this recipe does not build. Neither was run.
Adarsh Jagadish Kamini (4):
thrift: fix CVE-2026-55971
thrift: fix CVE-2026-58023
thrift: fix CVE-2026-48144
thrift: fix CVE-2026-58389
.../thrift/thrift/CVE-2026-48144.patch | 36 +++ .../thrift/thrift/CVE-2026-55971.patch | 92 +++++++ .../thrift/thrift/CVE-2026-58023.patch | 231 ++++++++++++++++++ .../thrift/thrift/CVE-2026-58389.patch | 93 +++++++ .../thrift/thrift_0.22.0.bb | 4 + 5 files changed, 456 insertions(+) create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-48144.patch create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-55971.patch create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-58023.patch create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-58389.patch
PATCH 1/4 thrift: fix CVE-2026-55971
From: Adarsh Jagadish Kamini <[email protected]>
Backport patch to fix CVE-2026-55971.
References:
https://nvd.nist.gov/vuln/detail/CVE-2026-55971
Upstream fix:
https://github.com/apache/thrift/commit/db4a473f3a984eee27273256fe737be5dd175595
Testing:
The backported fix ships with a C++ Boost regression test, test_theadertransport_zlib_roundtrip, in lib/cpp/test/ThrifttReadCheckTests.cpp. The recipe builds with -DBUILD_TESTING=OFF, so the C++ test suite is not compiled during a normal build. To verify the fix, the suite was built with BUILD_TESTING=ON (using the native thrift compiler for codegen via THRIFT_COMPILER) and the resulting UnitTests binary was executed against the target sysroot for MACHINE=qemux86-64.
Result: test_theadertransport_zlib_roundtrip passed. Full C++ UnitTests
suite: 79 of 80 test cases passed, 107659 of 107660 assertions passed. The single failure (ToStringTest/locale_de_DE_floating_point_to_string) is unrelated to this fix and is caused by the de_DE locale not being present in the minimal test sysroot.
--- .../thrift/thrift/CVE-2026-55971.patch | 92 +++++++++++++++++++ .../thrift/thrift_0.22.0.bb | 1 + 2 files changed, 93 insertions(+) create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-55971.patch
meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-55971.patch new file +92 -0
@@ -0,0 +1,92 @@ +From e5f8281298e4809d57143ed52933487fa90f20e0 Mon Sep 17 00:00:00 2001 +From: Jens Geyer <[email protected]> +Date: Wed, 17 Jun 2026 23:27:46 +0200 +Subject: [PATCH] Read the zlib transform result directly in THeaderTransport + untransform Client: cpp + +The zlib read path decompressed the frame into the transform buffer and then copied the result back into the receive buffer. Swap the transform buffer in as the receive buffer and read the result directly instead of copying it. + +Adds a write/read round-trip test through the zlib transform. + +Co-Authored-By: Claude Opus 4.8 <[email protected]> + +Backport notes: + - lib/cpp/src/thrift/transport/THeaderTransport.cpp: taken unchanged + from upstream. + - lib/cpp/test/ThrifttReadCheckTests.cpp: kept only the new + test_theadertransport_zlib_roundtrip test. The upstream + test_theadertransport_header_size_exceeds_frame test was dropped + because it depends on THRIFT-5854, which is not in 0.22.0. Added the + #include <thrift/transport/THeaderTransport.h> that the new test + needs (added upstream by THRIFT-5854). + +Assisted-by: kiro:claude-sonnet-5 + +CVE: CVE-2026-55971 +Upstream-Status: Backport [https://github.com/apache/thrift/commit/db4a473f3a984eee27273256fe737be5dd175595] + +Signed-off-by: Adarsh Jagadish Kamini <[email protected]> +--- + .../src/thrift/transport/THeaderTransport.cpp | 8 ++++++- + lib/cpp/test/ThrifttReadCheckTests.cpp | 24 +++++++++++++++++++ + 2 files changed, 31 insertions(+), 1 deletion(-) + +diff --git a/lib/cpp/src/thrift/transport/THeaderTransport.cpp b/lib/cpp/src/thrift/transport/THeaderTransport.cpp +index b3b833389..117c8edd5 100644 +--- a/lib/cpp/src/thrift/transport/THeaderTransport.cpp ++++ b/lib/cpp/src/thrift/transport/THeaderTransport.cpp +@@ -298,7 +298,13 @@ void THeaderTransport::untransform(uint8_t* ptr, uint32_t sz) { + "Error while zlib deflateEnd"); + } + +- memcpy(ptr, tBuf_.get(), sz); ++ // The result now lives in tBuf_ and is typically larger than the source ++ // section it was read from, so it does not fit back into the receive ++ // buffer at ptr. Swap the transform buffer in as the receive buffer and ++ // continue from its start instead of copying the result back in place. ++ rBuf_.swap(tBuf_); ++ std::swap(rBufSize_, tBufSize_); ++ ptr = rBuf_.get(); + } else { + throw TApplicationException(TApplicationException::MISSING_RESULT, "Unknown transform"); + } +diff --git a/lib/cpp/test/ThrifttReadCheckTests.cpp b/lib/cpp/test/ThrifttReadCheckTests.cpp +index 09dffe228..963286100 100644 +--- a/lib/cpp/test/ThrifttReadCheckTests.cpp ++++ b/lib/cpp/test/ThrifttReadCheckTests.cpp +@@ -31,6 +31,7 @@ + #include <memory> + #include <thrift/transport/TTransportUtils.h> + #include <thrift/transport/TBufferTransports.h> ++#include <thrift/transport/THeaderTransport.h> + #include <thrift/transport/TSimpleFileTransport.h> + #include <thrift/transport/TFileTransport.h> + #include <thrift/protocol/TEnum.h> +@@ -269,4 +270,27 @@ BOOST_AUTO_TEST_CASE(test_tthriftjsonprotocol_read_check_exception) { + protocol->readMapEnd(); + } + ++BOOST_AUTO_TEST_CASE(test_theadertransport_zlib_roundtrip) { ++ using apache::thrift::transport::THeaderTransport; ++ // A run of identical bytes compresses to far fewer bytes than it occupies ++ // once expanded again, so the result of the zlib transform is much larger ++ // than the frame section it is read from. This drives the full write/read ++ // round trip through the zlib transform path. Keep the payload small enough ++ // to stay within the transform buffer the reader sizes from its write buffer. ++ const std::size_t N = 700; ++ std::vector<uint8_t> payload(N, 0x42); ++ ++ std::shared_ptr<TMemoryBuffer> buffer(new TMemoryBuffer()); ++ std::shared_ptr<THeaderTransport> writer(new THeaderTransport(buffer)); ++ writer->setTransform(THeaderTransport::ZLIB_TRANSFORM); ++ writer->write(payload.data(), static_cast<uint32_t>(payload.size())); ++ writer->flush(); ++ ++ std::shared_ptr<THeaderTransport> reader(new THeaderTransport(buffer)); ++ std::vector<uint8_t> out(N, 0x00); ++ reader->readAll(out.data(), static_cast<uint32_t>(out.size())); ++ ++ BOOST_CHECK(out == payload); ++} ++ + BOOST_AUTO_TEST_SUITE_END()
meta-oe/recipes-connectivity/thrift/thrift_0.22.0.bb +1 -0
@@ -13,6 +13,7 @@ SRC_URI = "https://downloads.apache.org/${BPN}/${PV}/${BP}.tar.gz \ file://0001-support-reproducible-builds.patch \ file://CVE-2026-43868.patch \ file://CVE-2026-43870.patch \ + file://CVE-2026-55971.patch \ " SRC_URI[sha256sum] = "794a0e455787960d9f27ab92c38e34da27e8deeda7a5db0e59dc64a00df8a1e5"
PATCH 2/4 thrift: fix CVE-2026-58023
In reply to Adarsh Jagadish KaminiFrom: Adarsh Jagadish Kamini <[email protected]>
Backport patch to fix CVE-2026-58023.
References:
https://nvd.nist.gov/vuln/detail/CVE-2026-58023
Upstream fix:
https://github.com/apache/thrift/commit/d68305a7308a11df2c1daef16f55dbc19dfa6ff0
--- .../thrift/thrift/CVE-2026-58023.patch | 231 ++++++++++++++++++ .../thrift/thrift_0.22.0.bb | 1 + 2 files changed, 232 insertions(+) create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-58023.patch
meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-58023.patch new file +231 -0
@@ -0,0 +1,231 @@ +From 2f77969e8f841b225bd74bcfa4eeb341e78c06f7 Mon Sep 17 00:00:00 2001 +From: Javid Khan <[email protected]> +Date: Fri, 26 Jun 2026 21:35:32 +0200 +Subject: [PATCH] copy buffered data not the GByteArray struct in c_glib + read_slow Client: c_glib + +thrift_framed_transport_read_slow copies leftover bytes from the previous frame with memcpy(buf, t->r_buf, t->r_buf->len), passing the GByteArray struct pointer as the source instead of t->r_buf->data. The correct source is the buffer's data member, as used by the other memcpy calls in the same file. thrift_buffered_transport_read_slow contains the same mistake in its leftover path. Both are updated to read from t->r_buf->data, and a regression test using a memory buffer exercises the cross-boundary read path in each transport. + +This closes #3607 + +CVE: CVE-2026-58023 +Upstream-Status: Backport [https://github.com/apache/thrift/commit/d68305a7308a11df2c1daef16f55dbc19dfa6ff0] + +Signed-off-by: Adarsh Jagadish Kamini <[email protected]> +--- + .../transport/thrift_buffered_transport.c | 2 +- + .../transport/thrift_framed_transport.c | 2 +- + lib/c_glib/test/Makefile.am | 6 +- + lib/c_glib/test/testbufferedtransport.c | 47 ++++++++++++++ + lib/c_glib/test/testframedtransport.c | 62 +++++++++++++++++++ + 5 files changed, 115 insertions(+), 4 deletions(-) + +diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c +index 30aa95caf..21e3e42d4 100644 +--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c ++++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_buffered_transport.c +@@ -93,7 +93,7 @@ thrift_buffered_transport_read_slow (ThriftTransport *transport, gpointer buf, + /* first copy what we have in our buffer. */ + if (have > 0) + { +- memcpy (buf, t->r_buf, t->r_buf->len); ++ memcpy (buf, t->r_buf->data, t->r_buf->len); + want -= t->r_buf->len; + t->r_buf = g_byte_array_remove_range (t->r_buf, 0, t->r_buf->len); + } +diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c +index 3cbb245e0..8deed4119 100644 +--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c ++++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_framed_transport.c +@@ -138,7 +138,7 @@ thrift_framed_transport_read_slow (ThriftTransport *transport, gpointer buf, + /* first copy what we have in our buffer, if there is anything left */ + if (have > 0) + { +- memcpy (buf, t->r_buf, t->r_buf->len); ++ memcpy (buf, t->r_buf->data, t->r_buf->len); + want -= t->r_buf->len; + t->r_buf = g_byte_array_remove_range (t->r_buf, 0, t->r_buf->len); + } +diff --git a/lib/c_glib/test/Makefile.am b/lib/c_glib/test/Makefile.am +index 0a5f220ac..a879d9881 100644 +--- a/lib/c_glib/test/Makefile.am ++++ b/lib/c_glib/test/Makefile.am +@@ -150,7 +150,8 @@ testbufferedtransport_LDADD = \ + $(top_builddir)/lib/c_glib/src/thrift/c_glib/transport/libthrift_c_glib_la-thrift_socket.o \ + $(top_builddir)/lib/c_glib/src/thrift/c_glib/transport/libthrift_c_glib_la-thrift_server_transport.o \ + $(top_builddir)/lib/c_glib/src/thrift/c_glib/transport/libthrift_c_glib_la-thrift_server_socket.o \ +- $(top_builddir)/lib/c_glib/src/thrift/c_glib/libthrift_c_glib_la-thrift_configuration.o ++ $(top_builddir)/lib/c_glib/src/thrift/c_glib/transport/libthrift_c_glib_la-thrift_memory_buffer.o \ ++ $(top_builddir)/lib/c_glib/src/thrift/c_glib/libthrift_c_glib_la-thrift_configuration.o + + testframedtransport_SOURCES = testframedtransport.c + testframedtransport_LDADD = \ +@@ -158,7 +159,8 @@ testframedtransport_LDADD = \ + $(top_builddir)/lib/c_glib/src/thrift/c_glib/transport/libthrift_c_glib_la-thrift_socket.o \ + $(top_builddir)/lib/c_glib/src/thrift/c_glib/transport/libthrift_c_glib_la-thrift_server_transport.o \ + $(top_builddir)/lib/c_glib/src/thrift/c_glib/transport/libthrift_c_glib_la-thrift_server_socket.o \ +- $(top_builddir)/lib/c_glib/src/thrift/c_glib/libthrift_c_glib_la-thrift_configuration.o ++ $(top_builddir)/lib/c_glib/src/thrift/c_glib/transport/libthrift_c_glib_la-thrift_memory_buffer.o \ ++ $(top_builddir)/lib/c_glib/src/thrift/c_glib/libthrift_c_glib_la-thrift_configuration.o + + testzlibtransport_SOURCES = testzlibtransport.c + testzlibtransport_LDADD = \ +diff --git a/lib/c_glib/test/testbufferedtransport.c b/lib/c_glib/test/testbufferedtransport.c +index d01806d61..7493b7222 100644 +--- a/lib/c_glib/test/testbufferedtransport.c ++++ b/lib/c_glib/test/testbufferedtransport.c +@@ -25,6 +25,7 @@ + #include <thrift/c_glib/transport/thrift_socket.h> + #include <thrift/c_glib/transport/thrift_server_transport.h> + #include <thrift/c_glib/transport/thrift_server_socket.h> ++#include <thrift/c_glib/transport/thrift_memory_buffer.h> + + #define TEST_DATA { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' } + +@@ -306,6 +307,51 @@ test_write_fail(void) + } + } + ++/* A read larger than the bytes already sitting in the read buffer takes the ++ read_slow() path with have > 0. That leftover used to be copied from the ++ GByteArray structure itself rather than its data member, which corrupted the ++ result and over-read the small struct allocation once more than a handful of ++ bytes were buffered. Pre-load the buffer and drive the read through a memory ++ buffer so the path is exercised without a socket peer. */ ++static void ++test_read_across_buffer (void) ++{ ++ ThriftBufferedTransport *bt; ++ ThriftTransport *transport; ++ ThriftMemoryBuffer *membuf; ++ guchar leftover[96]; ++ guchar tail[4]; ++ guchar buf[100]; ++ gint32 got; ++ guint i; ++ ++ for (i = 0; i < sizeof (leftover); i++) ++ leftover[i] = (guchar) (0x10 + i); ++ for (i = 0; i < sizeof (tail); i++) ++ tail[i] = (guchar) (0xc0 + i); ++ ++ membuf = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, "buf_size", 1024, NULL); ++ thrift_transport_write (THRIFT_TRANSPORT (membuf), tail, sizeof (tail), NULL); ++ ++ transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT, ++ "transport", THRIFT_TRANSPORT (membuf), NULL); ++ ++ /* leave 96 bytes already buffered, more than sizeof(GByteArray) */ ++ bt = THRIFT_BUFFERED_TRANSPORT (transport); ++ g_byte_array_append (bt->r_buf, leftover, sizeof (leftover)); ++ ++ /* this read exceeds the buffered bytes and must return the real buffered ++ data followed by the freshly read tail, not the GByteArray structure */ ++ got = thrift_transport_read (transport, buf, 100, NULL); ++ g_assert (got == 100); ++ g_assert (memcmp (buf, leftover, 96) == 0); ++ g_assert (memcmp (buf + 96, tail, 4) == 0); ++ ++ thrift_transport_read_end (transport, NULL); ++ g_object_unref (transport); ++ g_object_unref (membuf); ++} ++ + int + main(int argc, char *argv[]) + { +@@ -319,6 +365,7 @@ main(int argc, char *argv[]) + g_test_add_func ("/testbufferedtransport/OpenAndClose", test_open_and_close); + g_test_add_func ("/testbufferedtransport/ReadAndWrite", test_read_and_write); + g_test_add_func ("/testbufferedtransport/WriteFail", test_write_fail); ++ g_test_add_func ("/testbufferedtransport/ReadAcrossBuffer", test_read_across_buffer); + + return g_test_run (); + } +diff --git a/lib/c_glib/test/testframedtransport.c b/lib/c_glib/test/testframedtransport.c +index 008e61e40..581b71067 100644 +--- a/lib/c_glib/test/testframedtransport.c ++++ b/lib/c_glib/test/testframedtransport.c +@@ -24,6 +24,7 @@ + #include <thrift/c_glib/transport/thrift_socket.h> + #include <thrift/c_glib/transport/thrift_server_transport.h> + #include <thrift/c_glib/transport/thrift_server_socket.h> ++#include <thrift/c_glib/transport/thrift_memory_buffer.h> + + #define TEST_DATA { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' } + +@@ -305,6 +306,66 @@ thrift_server (const int port) + g_object_unref (tsocket); + } + ++/* append a framed message (4-byte big-endian size header + body) */ ++static void ++append_frame (GByteArray *wire, const guchar *data, guint32 len) ++{ ++ guint32 netlen = htonl (len); ++ g_byte_array_append (wire, (const guchar *) &netlen, 4); ++ g_byte_array_append (wire, data, len); ++} ++ ++/* A read whose length crosses a frame boundary takes the read_slow() path ++ while bytes are still buffered from the previous frame. That leftover used ++ to be copied from the GByteArray structure itself rather than its data ++ member, corrupting the result and over-reading the heap once more than a ++ handful of bytes remained. Drive it through a memory buffer so the path is ++ exercised without a socket peer. */ ++static void ++test_read_across_frames (void) ++{ ++ guchar f1[100]; ++ guchar f2[100]; ++ guchar buf[100]; ++ gint32 got; ++ guint i; ++ ++ for (i = 0; i < sizeof (f1); i++) ++ { ++ f1[i] = (guchar) (0x10 + i); ++ f2[i] = (guchar) (0xc0 + i); ++ } ++ ++ GByteArray *wire = g_byte_array_new (); ++ append_frame (wire, f1, sizeof (f1)); ++ append_frame (wire, f2, sizeof (f2)); ++ ++ ThriftMemoryBuffer *membuf = g_object_new (THRIFT_TYPE_MEMORY_BUFFER, ++ "buf", wire, ++ "buf_size", (guint32) 0, ++ NULL); ++ ThriftTransport *transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT, ++ "transport", ++ THRIFT_TRANSPORT (membuf), ++ NULL); ++ ++ /* consume part of the first frame so 96 bytes stay buffered */ ++ got = thrift_transport_read (transport, buf, 4, NULL); ++ g_assert (got == 4); ++ g_assert (memcmp (buf, f1, 4) == 0); ++ ++ /* this read spans into the second frame and must return the real buffered ++ bytes, not the bytes of the GByteArray structure */ ++ got = thrift_transport_read (transport, buf, 100, NULL); ++ g_assert (got == 100); ++ g_assert (memcmp (buf, f1 + 4, 96) == 0); ++ g_assert (memcmp (buf + 96, f2, 4) == 0); ++ ++ thrift_transport_read_end (transport, NULL); ++ g_object_unref (transport); ++ g_object_unref (membuf); ++} ++ + int + main(int argc, char *argv[]) + { +@@ -318,6 +379,7 @@ main(int argc, char *argv[]) + g_test_add_func ("/testframedtransport/OpenAndClose", test_open_and_close); + g_test_add_func ("/testframedtransport/ReadAndWrite", test_read_and_write); + g_test_add_func ("/testframedtransport/ReadAfterPeerClose", test_read_after_peer_close); ++ g_test_add_func ("/testframedtransport/ReadAcrossFrames", test_read_across_frames); + + return g_test_run (); + }
meta-oe/recipes-connectivity/thrift/thrift_0.22.0.bb +1 -0
@@ -14,6 +14,7 @@ SRC_URI = "https://downloads.apache.org/${BPN}/${PV}/${BP}.tar.gz \ file://CVE-2026-43868.patch \ file://CVE-2026-43870.patch \ file://CVE-2026-55971.patch \ + file://CVE-2026-58023.patch \ " SRC_URI[sha256sum] = "794a0e455787960d9f27ab92c38e34da27e8deeda7a5db0e59dc64a00df8a1e5"
PATCH 3/4 thrift: fix CVE-2026-48144
In reply to Adarsh Jagadish KaminiFrom: Adarsh Jagadish Kamini <[email protected]>
Backport patch to fix CVE-2026-48144.
References:
https://nvd.nist.gov/vuln/detail/CVE-2026-48144
Upstream fix:
https://github.com/apache/thrift/commit/2b8baabc9be52807b08825e825bc0cd26568a193
--- .../thrift/thrift/CVE-2026-48144.patch | 36 +++++++++++++++++++ .../thrift/thrift_0.22.0.bb | 1 + 2 files changed, 37 insertions(+) create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-48144.patch
meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-48144.patch new file +36 -0
@@ -0,0 +1,36 @@ +From 4110973e59758dbeab5f527daae02f3b6a508bb0 Mon Sep 17 00:00:00 2001 +From: Jens Geyer <[email protected]> +Date: Thu, 21 May 2026 03:05:53 +0200 +Subject: [PATCH] Add peer hostname validation to c_glib TLS client Client: + c_glib + +Sets SSL_set1_host() before SSL_connect() so the peer certificate CN/SAN +is validated against the hostname. Guarded with OPENSSL_VERSION_NUMBER +>= 0x10100000L since SSL_set1_host() was introduced in OpenSSL 1.1.0. + +Co-Authored-By: Claude Sonnet 4.6 <[email protected]> + +CVE: CVE-2026-48144 +Upstream-Status: Backport [https://github.com/apache/thrift/commit/2b8baabc9be52807b08825e825bc0cd26568a193] + +Signed-off-by: Adarsh Jagadish Kamini <[email protected]> +--- + lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c +index 0afcb1b8f..4423a781c 100644 +--- a/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c ++++ b/lib/c_glib/src/thrift/c_glib/transport/thrift_ssl_socket.c +@@ -422,6 +422,11 @@ thrift_ssl_socket_handle_handshake(ThriftTransport * transport, GError **error) + if(ssl_socket->server){ + rc = SSL_accept(ssl_socket->ssl); + }else{ ++#if OPENSSL_VERSION_NUMBER >= 0x10100000L ++ if (socket->hostname != NULL) { ++ SSL_set1_host(ssl_socket->ssl, socket->hostname); ++ } ++#endif + rc = SSL_connect(ssl_socket->ssl); + } + if (rc <= 0) {
meta-oe/recipes-connectivity/thrift/thrift_0.22.0.bb +1 -0
@@ -15,6 +15,7 @@ SRC_URI = "https://downloads.apache.org/${BPN}/${PV}/${BP}.tar.gz \ file://CVE-2026-43870.patch \ file://CVE-2026-55971.patch \ file://CVE-2026-58023.patch \ + file://CVE-2026-48144.patch \ " SRC_URI[sha256sum] = "794a0e455787960d9f27ab92c38e34da27e8deeda7a5db0e59dc64a00df8a1e5"
PATCH 4/4 thrift: fix CVE-2026-58389
In reply to Adarsh Jagadish KaminiFrom: Adarsh Jagadish Kamini <[email protected]>
Backport patch to fix CVE-2026-58389.
References:
https://nvd.nist.gov/vuln/detail/CVE-2026-58389
Upstream fix:
https://github.com/apache/thrift/commit/0ab16e3a83637711f4e0f788c205f66576fd0a55
--- .../thrift/thrift/CVE-2026-58389.patch | 93 +++++++++++++++++++ .../thrift/thrift_0.22.0.bb | 1 + 2 files changed, 94 insertions(+) create mode 100644 meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-58389.patch
meta-oe/recipes-connectivity/thrift/thrift/CVE-2026-58389.patch new file +93 -0
@@ -0,0 +1,93 @@ +From 44c46c076527db5a4b97c55f09a6f73ab9443cee Mon Sep 17 00:00:00 2001 +From: Javid Khan <[email protected]> +Date: Mon, 29 Jun 2026 19:51:49 +0530 +Subject: [PATCH] enforce max_string_size on non-strict binary message name + + +CVE: CVE-2026-58389 +Upstream-Status: Backport [https://github.com/apache/thrift/commit/0ab16e3a83637711f4e0f788c205f66576fd0a55] + +Signed-off-by: Adarsh Jagadish Kamini <[email protected]> +--- + lib/rs/src/protocol/binary.rs | 61 +++++++++++++++++++++++++++++++++++ + 1 file changed, 61 insertions(+) + +diff --git a/lib/rs/src/protocol/binary.rs b/lib/rs/src/protocol/binary.rs +index 596285fb9..38f528571 100644 +--- a/lib/rs/src/protocol/binary.rs ++++ b/lib/rs/src/protocol/binary.rs +@@ -137,6 +137,17 @@ where + // is the message name. strings (byte arrays) are length-prefixed, + // so we've just read the length in the first 4 bytes + let name_size = BigEndian::read_i32(&first_bytes) as usize; ++ if let Some(max_size) = self.config.max_string_size() { ++ if name_size > max_size { ++ return Err(crate::Error::Protocol(ProtocolError::new( ++ ProtocolErrorKind::SizeLimit, ++ format!( ++ "Message name size {} exceeds maximum allowed size of {}", ++ name_size, max_size ++ ), ++ ))); ++ } ++ } + let mut name_buf: Vec<u8> = vec![0; name_size]; + self.transport.read_exact(&mut name_buf)?; + let name = String::from_utf8(name_buf)?; +@@ -1227,6 +1238,56 @@ mod tests { + } + } + ++ #[test] ++ fn must_enforce_string_size_limit_on_non_strict_message_name() { ++ let mem = TBufferChannel::with_capacity(100, 100); ++ let (r_mem, mut w_mem) = mem.split().unwrap(); ++ ++ let config = TConfiguration::builder() ++ .max_string_size(Some(1000)) ++ .build() ++ .unwrap(); ++ // non-strict: the first 4 bytes are the (positive) message-name length ++ let mut i_prot = TBinaryInputProtocol::with_config(r_mem, false, config); ++ ++ w_mem.set_readable_bytes(&[0x00, 0x00, 0x07, 0xD0]); ++ ++ let result = i_prot.read_message_begin(); ++ assert!(result.is_err()); ++ match result { ++ Err(crate::Error::Protocol(e)) => { ++ assert_eq!(e.kind, ProtocolErrorKind::SizeLimit); ++ assert!(e ++ .message ++ .contains("Message name size 2000 exceeds maximum allowed size of 1000")); ++ } ++ _ => panic!("Expected protocol error with SizeLimit"), ++ } ++ } ++ ++ #[test] ++ fn must_allow_non_strict_message_name_at_limit() { ++ let mem = TBufferChannel::with_capacity(100, 100); ++ let (r_mem, mut w_mem) = mem.split().unwrap(); ++ ++ let config = TConfiguration::builder() ++ .max_string_size(Some(5)) ++ .build() ++ .unwrap(); ++ // non-strict: the first 4 bytes are the (positive) message-name length ++ let mut i_prot = TBinaryInputProtocol::with_config(r_mem, false, config); ++ ++ // name length 5 (== limit), name "hello", message type Call, sequence 0 ++ w_mem.set_readable_bytes(&[ ++ 0x00, 0x00, 0x00, 0x05, b'h', b'e', b'l', b'l', b'o', 0x01, 0x00, 0x00, 0x00, 0x00, ++ ]); ++ ++ let ident = i_prot.read_message_begin().unwrap(); ++ assert_eq!(ident.name, "hello"); ++ assert_eq!(ident.message_type, TMessageType::Call); ++ assert_eq!(ident.sequence_number, 0); ++ } ++ + #[test] + fn must_allow_strings_within_limit() { + let mem = TBufferChannel::with_capacity(100, 100);
meta-oe/recipes-connectivity/thrift/thrift_0.22.0.bb +1 -0
@@ -16,6 +16,7 @@ SRC_URI = "https://downloads.apache.org/${BPN}/${PV}/${BP}.tar.gz \ file://CVE-2026-55971.patch \ file://CVE-2026-58023.patch \ file://CVE-2026-48144.patch \ + file://CVE-2026-58389.patch \ " SRC_URI[sha256sum] = "794a0e455787960d9f27ab92c38e34da27e8deeda7a5db0e59dc64a00df8a1e5"