Skip to content

Commit

Permalink
dependencies: update protobuf to 3.8.0 (#7510)
Browse files Browse the repository at this point in the history
In addition to updating protobuf to 3.8.0, this PR also

Removes old protobuf patch now included in 3.8.0
- Patches protocolbuffers/protobuf#6333 that fixes a UBSAN error in the protobuf library.
- Patches protobuf's BUILD to depend on foreign_cc zlib

Risk level: low/medium
Testing: bazel test //test/...

Signed-off-by: Asra Ali <asraa@google.com>
  • Loading branch information
asraa authored and htuch committed Jul 10, 2019
1 parent 08dc244 commit 8246167
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
6 changes: 3 additions & 3 deletions api/tools/data/tap2pcap_h2_ipv4.txt
@@ -1,6 +1,6 @@
1 0.000000 127.0.0.1 → 127.0.0.1 HTTP2 157 Magic, SETTINGS[0], WINDOW_UPDATE[0], HEADERS[1]: GET /
2 0.013713 127.0.0.1 → 127.0.0.1 HTTP2 91 SETTINGS[0], SETTINGS[0], WINDOW_UPDATE[0]
3 0.013820 127.0.0.1 → 127.0.0.1 HTTP2 63 SETTINGS[0]
3 0.013821 127.0.0.1 → 127.0.0.1 HTTP2 63 SETTINGS[0]
4 0.128649 127.0.0.1 → 127.0.0.1 HTTP2 5586 HEADERS[1]: 200 OK
5 0.130006 127.0.0.1 → 127.0.0.1 HTTP2 7573 DATA[1]
6 0.131044 127.0.0.1 → 127.0.0.1 HTTP2 3152 DATA[1], DATA[1] (text/html)
5 0.130007 127.0.0.1 → 127.0.0.1 HTTP2 7573 DATA[1]
6 0.131045 127.0.0.1 → 127.0.0.1 HTTP2 3152 DATA[1], DATA[1] (text/html)
41 changes: 20 additions & 21 deletions bazel/protobuf.patch
@@ -1,34 +1,33 @@
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
index 1d34870deb..3844fa6b8b 100644
index 3844fa6b8b..5486887295 100644
--- a/src/google/protobuf/stubs/strutil.cc
+++ b/src/google/protobuf/stubs/strutil.cc
@@ -1116,10 +1116,12 @@ char* FastUInt64ToBufferLeft(uint64 u64, char* buffer) {
@@ -1065,10 +1065,12 @@ char* FastUInt32ToBufferLeft(uint32 u, char* buffer) {
}

char* FastInt64ToBufferLeft(int64 i, char* buffer) {
- uint64 u = i;
+ uint64 u = 0;
char* FastInt32ToBufferLeft(int32 i, char* buffer) {
- uint32 u = i;
+ uint32 u = 0;
if (i < 0) {
*buffer++ = '-';
- u = -i;
+ u -= i;
+ } else {
+ u = i;
}
return FastUInt64ToBufferLeft(u, buffer);
return FastUInt32ToBufferLeft(u, buffer);
}
diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc
index ba0c3028ee..801a8e3786 100644
--- a/src/google/protobuf/text_format.cc
+++ b/src/google/protobuf/text_format.cc
@@ -1315,7 +1315,9 @@ class TextFormat::Printer::TextGenerator
while (size > buffer_size_) {
// Data exceeds space in the buffer. Write what we can and request a new
// buffer.
- memset(buffer_, ' ', buffer_size_);
+ if (buffer_size_ > 0) {
+ memset(buffer_, ' ', buffer_size_);
+ }
size -= buffer_size_;
void* void_buffer;
failed_ = !output_->Next(&void_buffer, &buffer_size_);

diff --git a/BUILD b/BUILD
index 6665de94..55f28582 100644
--- a/BUILD
+++ b/BUILD
@@ -19,6 +19,6 @@ config_setting(
# ZLIB configuration
################################################################################

-ZLIB_DEPS = ["@zlib//:zlib"]
+ZLIB_DEPS = ["//external:zlib"]

################################################################################
# Protobuf Runtime Library
14 changes: 8 additions & 6 deletions bazel/repositories.bzl
Expand Up @@ -486,9 +486,10 @@ def _com_google_absl():
def _com_google_protobuf():
_repository_impl(
"com_google_protobuf",
# The patch is only needed until
# https://github.com/protocolbuffers/protobuf/pull/5901 is available.
# TODO(htuch): remove this when > protobuf 3.7.1 is released.
# The patch includes
# https://github.com/protocolbuffers/protobuf/pull/6333 and also uses
# foreign_cc build for zlib as its dependency.
# TODO(asraa): remove this when > protobuf 3.8.0 is released.
patch_args = ["-p1"],
patches = ["@envoy//bazel:protobuf.patch"],
)
Expand All @@ -499,9 +500,10 @@ def _com_google_protobuf():
_repository_impl(
"com_google_protobuf_cc",
repository_key = "com_google_protobuf",
# The patch is only needed until
# https://github.com/protocolbuffers/protobuf/pull/5901 is available.
# TODO(htuch): remove this when > protobuf 3.7.1 is released.
# The patch includes
# https://github.com/protocolbuffers/protobuf/pull/6333 and also uses
# foreign_cc build for zlib as its dependency.
# TODO(asraa): remove this when > protobuf 3.8.0 is released.
patch_args = ["-p1"],
patches = ["@envoy//bazel:protobuf.patch"],
)
Expand Down
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Expand Up @@ -205,9 +205,9 @@ REPOSITORY_LOCATIONS = dict(
urls = ["https://github.com/google/googletest/archive/d7003576dd133856432e2e07340f45926242cc3a.tar.gz"],
),
com_google_protobuf = dict(
sha256 = "c10ef8d8ad5a9e5f850483051b7f9ee2c8bb3ca2e0e16a4cf105bd1321afb2d6",
strip_prefix = "protobuf-3.7.1",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protobuf-all-3.7.1.tar.gz"],
sha256 = "b7220b41481011305bf9100847cf294393973e869973a9661046601959b2960b",
strip_prefix = "protobuf-3.8.0",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.8.0/protobuf-all-3.8.0.tar.gz"],
),
grpc_httpjson_transcoding = dict(
sha256 = "dedd76b0169eb8c72e479529301a1d9b914a4ccb4d2b5ddb4ebe92d63a7b2152",
Expand Down

0 comments on commit 8246167

Please sign in to comment.