From dc12f3e8278fa2eb2b2c0ae1ccce16e5c7dc295b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=89=BE=E5=84=92?= Date: Wed, 17 Apr 2024 15:49:08 +0800 Subject: [PATCH] fix protobuf asan failed --- bazel/patches/protobuf.patch | 16 ++++++++++++++++ bazel/repositories.bzl | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 bazel/patches/protobuf.patch diff --git a/bazel/patches/protobuf.patch b/bazel/patches/protobuf.patch new file mode 100644 index 00000000..088b49a0 --- /dev/null +++ b/bazel/patches/protobuf.patch @@ -0,0 +1,16 @@ +diff --git a/src/google/protobuf/wire_format.h b/src/google/protobuf/wire_format.h +index 1acbf9e1f..ff2f62282 100644 +--- a/src/google/protobuf/wire_format.h ++++ b/src/google/protobuf/wire_format.h +@@ -356,8 +356,9 @@ inline size_t WireFormat::TagSize(int field_number, + inline void WireFormat::VerifyUTF8String(const char* data, int size, + WireFormat::Operation op) { + #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED +- WireFormatLite::VerifyUtf8String( +- data, size, static_cast(op), nullptr); ++ WireFormatLite::VerifyUtf8String(data, size, ++ static_cast(op), ++ /* field_name = */ ""); + #else + // Avoid the compiler warning about unused variables. + (void)data; diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 82565d49..f2adb6d0 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -146,6 +146,8 @@ def _com_google_protobuf(): sha256 = "2c6a36c7b5a55accae063667ef3c55f2642e67476d96d355ff0acb13dbb47f09", strip_prefix = "protobuf-21.12", type = "tar.gz", + patch_args = ["-p1"], + patches = ["@yacl//bazel:patches/protobuf.patch"], urls = [ "https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protobuf-all-21.12.tar.gz", ],