Skip to content

Commit

Permalink
protobuf: add back ubsan patch (envoyproxy#8417)
Browse files Browse the repository at this point in the history
Adds back protobuf patch fixing UBSAN error (protocolbuffers/protobuf#6333).
This was removed on updating protobuf to 3.9.1, but will be included in the protobuf 3.10 release.

Fixes OSS-Fuzz issue:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17759
Testing: Added corpus

Signed-off-by: Asra Ali <asraa@google.com>
  • Loading branch information
asraa committed Sep 27, 2019
1 parent 2b63e91 commit 5f96f8b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
20 changes: 20 additions & 0 deletions bazel/protobuf.patch
@@ -1,3 +1,23 @@
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
index 3844fa6b8b..5486887295 100644
--- a/src/google/protobuf/stubs/strutil.cc
+++ b/src/google/protobuf/stubs/strutil.cc
@@ -1065,10 +1065,12 @@ char* FastUInt32ToBufferLeft(uint32 u, char* buffer) {
}

char* FastInt32ToBufferLeft(int32 i, char* buffer) {
- uint32 u = i;
+ uint32 u = 0;
if (i < 0) {
*buffer++ = '-';
- u = -i;
+ u -= i;
+ } else {
+ u = i;
}
return FastUInt32ToBufferLeft(u, buffer);
}

diff --git a/BUILD b/BUILD
index 6665de94..55f28582 100644
--- a/BUILD
Expand Down
4 changes: 2 additions & 2 deletions bazel/repositories.bzl
Expand Up @@ -507,7 +507,7 @@ def _com_google_protobuf():
# 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.
# TODO(asraa): remove this when protobuf 3.10 is released.
patch_args = ["-p1"],
patches = ["@envoy//bazel:protobuf.patch"],
)
Expand All @@ -521,7 +521,7 @@ def _com_google_protobuf():
# 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.
# TODO(asraa): remove this when protobuf 3.10 is released.
patch_args = ["-p1"],
patches = ["@envoy//bazel:protobuf.patch"],
)
Expand Down
@@ -0,0 +1,11 @@
config {
vhds {
config_source {
api_config_source {
request_timeout {
nanos: -2147483648
}
}
}
}
}

0 comments on commit 5f96f8b

Please sign in to comment.