Skip to content

Pass message_factory to reflection->GetMessage in cel::Value::WrapField. - #2186

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_957173111
Open

Pass message_factory to reflection->GetMessage in cel::Value::WrapField.#2186
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_957173111

Conversation

@copybara-service

Copy link
Copy Markdown

Pass message_factory to reflection->GetMessage in cel::Value::WrapField.

Inside WrapFieldImpl in value.cc, CEL called reflection->GetMessage(*message, field)
without passing message_factory as the 3rd argument. When message is a compiled C++
GeneratedMessage, Protobuf reflection defaulted factory to MessageFactory::generated_factory().

If field is an extension whose descriptor lives in a dynamic DescriptorPool,
generated_factory()->GetPrototype(extension_desc) returns nullptr, causing a
SIGSEGV (@(nil)) in ExtensionSet::GetMessage().

This CL passes message_factory to reflection->GetMessage(*message, field, message_factory)
so Protobuf reflection uses CEL's MessageFactory to resolve dynamic extensions.

Inside WrapFieldImpl in value.cc, CEL called reflection->GetMessage(*message, field)
without passing message_factory as the 3rd argument. When message is a compiled C++
GeneratedMessage, Protobuf reflection defaulted factory to MessageFactory::generated_factory().

If field is an extension whose descriptor lives in a dynamic DescriptorPool,
generated_factory()->GetPrototype(extension_desc) returns nullptr, causing a
SIGSEGV (@(nil)) in ExtensionSet::GetMessage().

This CL passes message_factory to reflection->GetMessage(*message, field, message_factory)
so Protobuf reflection uses CEL's MessageFactory to resolve dynamic extensions.

PiperOrigin-RevId: 957173111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant