-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: patch protobuf for UBSAN issue. (#6721)
Since #6610 the fuzzer build has been broken. This is due to the interaction of rules_foreign_cc external dependencies and the additional UBSAN blacklist maintained by the oss-fuzz driver to workaround the fact we don't have protocolbuffers/protobuf#5901 yet. This PR moves protocolbuffers/protobuf#5901 into Envoy proper and hence we don't need an UBSAN blacklist in the oss-fuzz driver anymore. Risk level: Low Tesitng: oss-fuzz Docker build. Signed-off-by: Harvey Tuch <[email protected]>
- Loading branch information
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc | ||
index 1d34870deb..3844fa6b8b 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) { | ||
} | ||
|
||
char* FastInt64ToBufferLeft(int64 i, char* buffer) { | ||
- uint64 u = i; | ||
+ uint64 u = 0; | ||
if (i < 0) { | ||
*buffer++ = '-'; | ||
- u = -i; | ||
+ u -= i; | ||
+ } else { | ||
+ u = i; | ||
} | ||
return FastUInt64ToBufferLeft(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_); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters