Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cel: patch thread safety issue #13739

Merged
merged 3 commits into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions bazel/cel-cpp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff --git a/eval/eval/field_backed_map_impl.cc b/eval/eval/field_backed_map_impl.cc
index cd56f51..4d2a546 100644
--- a/eval/eval/field_backed_map_impl.cc
+++ b/eval/eval/field_backed_map_impl.cc
@@ -117,7 +117,9 @@ int FieldBackedMapImpl::size() const {
const CelList* FieldBackedMapImpl::ListKeys() const { return key_list_.get(); }

absl::optional<CelValue> FieldBackedMapImpl::operator[](CelValue key) const {
-#ifdef GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND
+#ifdef XXX_GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND
+ static_assert(false);
+
// Fast implementation.
google::protobuf::MapKey inner_key;
switch (key.type()) {
@@ -171,7 +173,7 @@ absl::optional<CelValue> FieldBackedMapImpl::operator[](CelValue key) const {
return CreateErrorValue(arena_, status.message());
}
return result;
-#else // GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND
+#else // XXX_GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND
// Slow implementation.
CelValue result = CelValue::CreateNull();
CelValue inner_key = CelValue::CreateNull();
@@ -228,7 +230,7 @@ absl::optional<CelValue> FieldBackedMapImpl::operator[](CelValue key) const {
}

return {};
-#endif // GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND
+#endif // XXX_GOOGLE_PROTOBUF_HAS_CEL_MAP_REFLECTION_FRIEND
}

} // namespace runtime
7 changes: 6 additions & 1 deletion bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,12 @@ def _com_github_zlib_ng_zlib_ng():
)

def _com_google_cel_cpp():
external_http_archive("com_google_cel_cpp")
external_http_archive(
"com_google_cel_cpp",
patch_args = ["-p1"],
# Patches to remove "fast" protobuf-internal access
patches = ["@envoy//bazel:cel-cpp.patch"],
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a TODO explaining when / how the patch can be removed upon protobuf and cel-cpp update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an explanation.

external_http_archive("rules_antlr")

# Parser dependencies
Expand Down