summaryrefslogtreecommitdiff
path: root/user/protobuf/32bit.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2022-11-24 05:42:23 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2022-11-24 05:42:23 +0000
commit397839a608be984d01eb0437874ed758204947cd (patch)
tree81517555df125db56fe6f2482612366f61424e8e /user/protobuf/32bit.patch
parent9e3238a0e5e0ad4835023206bb6114c0df97f8fc (diff)
downloadpackages-397839a608be984d01eb0437874ed758204947cd.tar.gz
packages-397839a608be984d01eb0437874ed758204947cd.tar.bz2
packages-397839a608be984d01eb0437874ed758204947cd.tar.xz
packages-397839a608be984d01eb0437874ed758204947cd.zip
user/protobuf: Update to 3.20.3, fix 32-bit build
Patch from upstream to fix 32-bit. Patch requires C++14, so that was also backported. 3.20.3 fixes two security issues, but no CVEs were assigned. Closes: #865
Diffstat (limited to 'user/protobuf/32bit.patch')
-rw-r--r--user/protobuf/32bit.patch121
1 files changed, 121 insertions, 0 deletions
diff --git a/user/protobuf/32bit.patch b/user/protobuf/32bit.patch
new file mode 100644
index 000000000..4630d8afa
--- /dev/null
+++ b/user/protobuf/32bit.patch
@@ -0,0 +1,121 @@
+From 5f4a52d9bff7595ec47fb6727662a1cada3cd404 Mon Sep 17 00:00:00 2001
+From: Mike Kruskal <mkruskal@google.com>
+Date: Thu, 15 Sep 2022 10:23:23 -0700
+Subject: [PATCH 3/7] Patching static assert test failure
+
+---
+ src/google/protobuf/extension_set_unittest.cc | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc
+index 8b436bc20c9..84da3c5465a 100644
+--- a/src/google/protobuf/extension_set_unittest.cc
++++ b/src/google/protobuf/extension_set_unittest.cc
+@@ -855,8 +855,10 @@ TEST(ExtensionSetTest, SpaceUsedExcludingSelf) {
+ const size_t old_capacity = \
+ message->GetRepeatedExtension(unittest::repeated_##type##_extension) \
+ .Capacity(); \
+- EXPECT_GE(old_capacity, \
+- (RepeatedFieldLowerClampLimit<cpptype, sizeof(void*)>())); \
++ EXPECT_GE( \
++ old_capacity, \
++ (RepeatedFieldLowerClampLimit<cpptype, std::max(sizeof(cpptype), \
++ sizeof(void*))>())); \
+ for (int i = 0; i < 16; ++i) { \
+ message->AddExtension(unittest::repeated_##type##_extension, value); \
+ } \
+
+From c94b66706bec17d918495f4715183a5eaf0f8044 Mon Sep 17 00:00:00 2001
+From: Mike Kruskal <mkruskal@google.com>
+Date: Thu, 15 Sep 2022 11:31:31 -0700
+Subject: [PATCH 4/7] Test fixes for 32-bit architectures
+
+---
+ .../protobuf/io/zero_copy_stream_unittest.cc | 3 ++
+ .../protobuf/repeated_field_unittest.cc | 4 +--
+ src/google/protobuf/util/time_util_test.cc | 28 +++++++++++--------
+ 3 files changed, 22 insertions(+), 13 deletions(-)
+
+diff --git a/src/google/protobuf/io/zero_copy_stream_unittest.cc b/src/google/protobuf/io/zero_copy_stream_unittest.cc
+index d82354e571b..d656da5f13b 100644
+--- a/src/google/protobuf/io/zero_copy_stream_unittest.cc
++++ b/src/google/protobuf/io/zero_copy_stream_unittest.cc
+@@ -720,6 +720,9 @@ TEST_F(IoTest, StringIo) {
+
+ // Verifies that outputs up to kint32max can be created.
+ TEST_F(IoTest, LargeOutput) {
++ // Filter out this test on 32-bit architectures.
++ if(sizeof(void*) < 8) return;
++
+ std::string str;
+ StringOutputStream output(&str);
+ void* unused_data;
+diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc
+index eb0b9091cf8..3baf6f25bb2 100644
+--- a/src/google/protobuf/repeated_field_unittest.cc
++++ b/src/google/protobuf/repeated_field_unittest.cc
+@@ -429,14 +429,14 @@ TEST(RepeatedField, ReserveNothing) {
+
+ TEST(RepeatedField, ReserveLowerClamp) {
+ int clamped_value = internal::CalculateReserveSize<bool, sizeof(void*)>(0, 1);
+- EXPECT_GE(clamped_value, 8 / sizeof(bool));
++ EXPECT_GE(clamped_value, sizeof(void*) / sizeof(bool));
+ EXPECT_EQ((internal::RepeatedFieldLowerClampLimit<bool, sizeof(void*)>()),
+ clamped_value);
+ // EXPECT_EQ(clamped_value, (internal::CalculateReserveSize<bool,
+ // sizeof(void*)>( clamped_value, 2)));
+
+ clamped_value = internal::CalculateReserveSize<int, sizeof(void*)>(0, 1);
+- EXPECT_GE(clamped_value, 8 / sizeof(int));
++ EXPECT_GE(clamped_value, sizeof(void*) / sizeof(int));
+ EXPECT_EQ((internal::RepeatedFieldLowerClampLimit<int, sizeof(void*)>()),
+ clamped_value);
+ // EXPECT_EQ(clamped_value, (internal::CalculateReserveSize<int,
+diff --git a/src/google/protobuf/util/time_util_test.cc b/src/google/protobuf/util/time_util_test.cc
+index 464e57b4ee5..dceb6dbe2bf 100644
+--- a/src/google/protobuf/util/time_util_test.cc
++++ b/src/google/protobuf/util/time_util_test.cc
+@@ -48,15 +48,18 @@ using google::protobuf::Timestamp;
+ namespace {
+
+ TEST(TimeUtilTest, TimestampStringFormat) {
+- Timestamp begin, end;
+- EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
+- EXPECT_EQ(TimeUtil::kTimestampMinSeconds, begin.seconds());
+- EXPECT_EQ(0, begin.nanos());
+- EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));
+- EXPECT_EQ(TimeUtil::kTimestampMaxSeconds, end.seconds());
+- EXPECT_EQ(999999999, end.nanos());
+- EXPECT_EQ("0001-01-01T00:00:00Z", TimeUtil::ToString(begin));
+- EXPECT_EQ("9999-12-31T23:59:59.999999999Z", TimeUtil::ToString(end));
++ // These these are out of bounds for 32-bit architectures.
++ if(sizeof(time_t) >= sizeof(uint64_t)) {
++ Timestamp begin, end;
++ EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
++ EXPECT_EQ(TimeUtil::kTimestampMinSeconds, begin.seconds());
++ EXPECT_EQ(0, begin.nanos());
++ EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));
++ EXPECT_EQ(TimeUtil::kTimestampMaxSeconds, end.seconds());
++ EXPECT_EQ(999999999, end.nanos());
++ EXPECT_EQ("0001-01-01T00:00:00Z", TimeUtil::ToString(begin));
++ EXPECT_EQ("9999-12-31T23:59:59.999999999Z", TimeUtil::ToString(end));
++ }
+
+ // Test negative timestamps.
+ Timestamp time = TimeUtil::NanosecondsToTimestamp(-1);
+@@ -94,9 +97,12 @@ TEST(TimeUtilTest, DurationStringFormat) {
+ EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
+ EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));
+
+- EXPECT_EQ("315537897599.999999999s", TimeUtil::ToString(end - begin));
++ // These these are out of bounds for 32-bit architectures.
++ if(sizeof(time_t) >= sizeof(uint64_t)) {
++ EXPECT_EQ("315537897599.999999999s", TimeUtil::ToString(end - begin));
++ EXPECT_EQ("-315537897599.999999999s", TimeUtil::ToString(begin - end));
++ }
+ EXPECT_EQ(999999999, (end - begin).nanos());
+- EXPECT_EQ("-315537897599.999999999s", TimeUtil::ToString(begin - end));
+ EXPECT_EQ(-999999999, (begin - end).nanos());
+
+ // Generated output should contain 3, 6, or 9 fractional digits.
+