v37.0-rc1Pre-release
Protocol Buffers v37.0-rc1
Added 4
- Add compiler flag --source_code_info_out to output SourceCodeInfo separately
- Detect single-crate cross-file symbol collisions and conditionally emit crate-root re-exports
- Implement GetSourceLocation for sub-fields and names of aggregate options
- Log a warning in JsonFormat when printing extension fields with short names
Changed 10
- Apply protoc depth limit of nested messages also to group types
- Silence bad error when option dependencies are missing in the filesystem but present in input descriptor sets
- Accept absl::Cord by value in Protobuf setters
- Optimize ReadSize with 2-byte inlined fast path in parse_context.h
- Suppress deprecation warnings for EnumTraitsImpl on deprecated enums
- Honor cc_namespace option by using updated Namespace()
- Align DynamicMessage.hashCode() with GeneratedMessage.hashCode()
- Avoid empty byte array allocations in Proto Lite toByteArray()
- Avoid UTF8 length calculations in ArrayEncoder.writeStringNoTag
- Omit GET_MEMOIZED_IS_INITIALIZED in Java Lite for messages without required fields
Fixed 4
- Fix InlinedStringField memory leak when string donation is disabled
- Fix data race in Python free threading by removing obsolete hack
- Fix LazyField parsing with a custom DescriptorPool or MessageFactory that failed or lost extension data
- Harden StreamDecoder against integer overflow risks above 2 GiB
Deprecated 2
- Mark deprecated Enum messages as deprecated within C++ generated code
- Add deprecation warning for Reflection::GetEnum() and Reflection::GetRepeatedEnum()
Security 1
- Add field ownership check to SwapFields to prevent out-of-bounds memory access
From Protocol Buffers
Announcements
- Protobuf News may include additional announcements or pre-announcements for upcoming changes.
Bazel
- Prepare Protobuf for a future version of Bazel which will lack the proto fragment (https://github.com/protocolbuffers/protobuf/commit/f1c23cb216347437d0a190a23b9ecf46873db367)
Compiler
- Add compiler flag --source_code_info_out to output SourceCodeInfo separately. (https://github.com/protocolbuffers/protobuf/commit/6acc31c90851fbc4f1af41a32717054233e1297a)
- Detects single-crate cross-file symbol collisions and conditionally emits crate-root re-exports. (https://github.com/protocolbuffers/protobuf/commit/e25ea67744bb30a7735ace3305c563e9c82b152a)
- Apply protoc depth limit of nested messages also to group types. (https://github.com/protocolbuffers/protobuf/commit/77eb569b424235fcb54c31a766126f13ac80b827)
- Silence bad error when option dependencies are missing in the filesystem but present in input descriptor sets. (https://github.com/protocolbuffers/protobuf/commit/71e45486e3c38428903b1d813c27565a9f074892)
- Implement GetSourceLocation for sub-fields and names of aggregate options. (https://github.com/protocolbuffers/protobuf/commit/c251d1ab57e28a5fcbd9be13da49881b977482ce)
C++
- Accept absl::Cord by value in Protobuf setters. (https://github.com/protocolbuffers/protobuf/commit/4d7adfc445c7c955e6dafbd010647e1033be6c22)
- Optimize ReadSize with 2-byte inlined fast path in parse_context.h (https://github.com/protocolbuffers/protobuf/commit/524c72e0fa9bd222fde40c23de82e87b000b53c4)
- Add field ownership check to SwapFields to prevent OOB memory access (#27289) (https://github.com/protocolbuffers/protobuf/commit/6ab198d638e59af30d9666946f291f9b991b8a41)
- Suppress deprecation warnings for EnumTraitsImpl on deprecated enums.(https://github.com/protocolbuffers/protobuf/commit/3b378b0f5a6d0ea593441ff23865732d6a1c40c6)
- Marking deprecated Enum messages deprecated within c++ gencode. (https://github.com/protocolbuffers/protobuf/commit/f70a00f1d861aa18bcdebbde24bebbb2f27e6bec)
- Honor cc_namespace option by using updated Namespace() (https://github.com/protocolbuffers/protobuf/commit/2b880cfda25967df1e5eb58f5c66247899e10c20)
- Fix InlinedStringField memory leak when string donation is disabled. (https://github.com/protocolbuffers/protobuf/commit/98fa2c5a4464be9c05f76cb627e31559b272ded6)
- Prepare Protobuf for a future version of Bazel which will lack the proto fragment (https://github.com/protocolbuffers/protobuf/commit/f1c23cb216347437d0a190a23b9ecf46873db367)
- [Py/C++] Fixed data race in Python free threading by removing obsolete hack (https://github.com/protocolbuffers/protobuf/commit/1a238308815176a92ba177d598cbdc6aa3b3290d)
- Automated rollback of commit 780ba8c700af70dcbdcd05c3100440331b850019. (https://github.com/protocolbuffers/protobuf/commit/915853d5ef3e7352dda345ad6cfbeac233e41b17)
- Silence bad error when option dependencies are missing in the filesystem but present in input descriptor sets. (https://github.com/protocolbuffers/protobuf/commit/71e45486e3c38428903b1d813c27565a9f074892)
- Fix a bug in LazyField where parsing with a custom DescriptorPool or MessageFactory failed or lost extension data (b/519244881). (https://github.com/protocolbuffers/protobuf/commit/5d717fd0a93ee0f780c58e106b2c23147f278075)
- Implement GetSourceLocation for sub-fields and names of aggregate options. (https://github.com/protocolbuffers/protobuf/commit/c251d1ab57e28a5fcbd9be13da49881b977482ce)
- Add deprecation warning for
Reflection::GetEnum()andReflection::GetRepeatedEnum(). (https://github.com/protocolbuffers/protobuf/commit/6a31b747f25f686adb822572b28da285d4adda66)
Java
- Log a warning in JsonFormat when printing extension fields with short names. (https://github.com/protocolbuffers/protobuf/commit/086584c7ed6f6b5680bb628fecd1f6c6dd38787a)
- Align DynamicMessage.hashCode() with GeneratedMessage.hashCode() (https://github.com/protocolbuffers/protobuf/commit/799556e8df354bddec56ec049ab2b3b413089fcf)
- Harden StreamDecoder in the face of >2 GiB INT_MAX overflow risks. (https://github.com/protocolbuffers/protobuf/commit/925e0f544891038494ff7ae62b6726c768e6762a)
- Avoid empty byte array allocations in Proto Lite toByteArray(). (https://github.com/protocolbuffers/protobuf/commit/dee117a78747ccb1e44e9efcf2f8f71640f65b8d)
- Avoid UTF8 length calculations in ArrayEncoder.writeStringNoTag (https://github.com/protocolbuffers/protobuf/commit/54fe86b091dbb3c354f61463b9315c873fb4f703)
- Omit GET_MEMOIZED_IS_INITIALIZED in Java Lite for messages without required fields. (https://github.com/protocolbuffers/protobuf/commit/572ca36fd70adb703c595c5b076df65e426949ad)
- Inline MapEntryLite default instances in generated Java Lite code. (https://github.com/protocolbuffers/protobuf/commit/1aaaaaec9f3bf4e633f6ca351557d293429b74de)
- Automated rollback of commit ea0e67a9ca893bc542a27b37b3c5df58f03b11d5. (https://github.com/protocolbuffers/protobuf/commit/bbe28f23d3c46a9b8595851e9065ec6e5a7ab905)
- Use ConcurrentMap in GeneratedMessageLite parser registry to avoid unsafe Java 8 API usage. (https://github.com/protocolbuffers/protobuf/commit/b0b22dd281917ea4a42f2638e3aa84133efb05e1)
- Optimize Java Lite Map Field Codegen by removing DefaultEntryHolder (https://github.com/protocolbuffers/protobuf/commit/e1acb1a02e904f679be19ded2c1eb0ad66cd3fe7)
- Optimize GeneratedMessageLite parser registry to reduce memory footprint. (https://github.com/protocolbuffers/protobuf/commit/687c7d589200fa7f7b15d567beddef0665be8155)
- Optimize Java Lite Parser Registry with Centralized Cache (https://github.com/protocolbuffers/protobuf/commit/51df91d19a672c19b96601afb58e3d95df6cfd53)
Kotlin
-
- Updates DslList and ExtensionList to take a lazy supplier lambda () -> List, retaining secondary constructors for binary backward compatibility with existing compiled proto code. (https://github.com/protocolbuffers/protobuf/commit/37f78578e77590657e0b4fbd9a77d54b0315a89f)
Csharp
- Allow later enum aliases to overwrite in C# custom JSON enum mapping. (https://github.com/protocolbuffers/protobuf/commit/6836552e2573b833f3375b1a781625897688d1c2)
Objective-C
- [ObjC] Raise the Xcode project minimum iOS version to 15 (#30092) (https://github.com/protocolbuffers/protobuf/commit/86835328769c135746163f55022b554f79b77e4a)
- Deprecate Objective-C support in the protobuf compiler. (https://github.com/protocolbuffers/protobuf/commit/7cfcf45c59e452cdce18f073a7207f7330f85545)
- Validate php_class_prefix and objc_class_prefix in code generators (#29130) (https://github.com/protocolbuffers/protobuf/commit/1e1a0a8c76f2e5dc6ed734439fd79ca90cffe96e)
- [ObjC] Carry recursion depth across MessageSet item parsing (#27571) (https://github.com/protocolbuffers/protobuf/commit/dd9d2ad02d142a0ed744f09149e5b62fdcd0fd24)
Rust
- Wrapping Rust thunk gencode with deprecation suppression. Rust generates call fields for all messages (deprecated or not) in their
thunk.cc. This would trigger deprecation warnings [-Wdeprecated-declarations] on all deprecated proto messages. (https://github.com/protocolbuffers/protobuf/commit/1d004b25febfbe48f0ab223c719ecaed0663d6a3) - Rename Rust protobuf Proxied and MutProxied traits to ProtoObject and MutProtoObject and clarify rustdoc about what these things are. (https://github.com/protocolbuffers/protobuf/commit/0a3a348ae4ca94b5908ed3128f4cb670df52cb18)
- Rust: Give generated proto enums a
const fn number()(https://github.com/protocolbuffers/protobuf/commit/41f607275ca348142588f41679a50d28d78974dd) - Release the google-protobuf-example, google-protobuf-macros and google-protobuf-well-known-types crates, and stop publishing the legacy protobuf-* crates for 37.x+ (https://github.com/protocolbuffers/protobuf/commit/db9cb46db2b61c672285c968929853ce19b57b97)
- Slightly relax the Mut<'_> lifetime in RepeatedMut get_mut (https://github.com/protocolbuffers/protobuf/commit/a5baafe28606b981057e3e16d84978658b00a30e)
- Update README to note that the protobuf crate is superseded by google-protobuf. (https://github.com/protocolbuffers/protobuf/commit/8e70aa93f986bc5706ad494fb8e4eee94ffaf5fb)
- Detects single-crate cross-file symbol collisions and conditionally emits crate-root re-exports. (https://github.com/protocolbuffers/protobuf/commit/e25ea67744bb30a7735ace3305c563e9c82b152a)
- Rust protobuf matchers: Add a
partiallymatcher to mirror C++ (https://github.com/protocolbuffers/protobuf/commit/e1c5f3ac47fa88e3702eb402ece4594805ef1e5c) - Re-export to google-protobuf crate in 0.x.y for 36.0 and above (https://github.com/protocolbuffers/protobuf/commit/97fcd43558624fd07b46fe8b61cc16dba5d21850)
- Remove iterator trait implementations for RepeatedMutIter (https://github.com/protocolbuffers/protobuf/commit/e8bd2b5dccbed0b9b24e8ba51bba7868894ae53a)
- Enable inherent next() and next_back() API for RepeatedMutIter besides trait implementation. (https://github.com/protocolbuffers/protobuf/commit/b1b5f993e81dfd42a60388e4a590dcc6940fd7b8)
- Add required_providers to proto aspect (https://github.com/protocolbuffers/protobuf/commit/aed6a821d170814c91536d1f2945dc755215278c)
- Escape all non-alnum chars in Rust module names (https://github.com/protocolbuffers/protobuf/commit/8ce2a36efd9212f57ecec4a34594f7f9234c8046)
- Fix the behavior of GetOrCreateMutableMessage on fields in oneofs (https://github.com/protocolbuffers/protobuf/commit/ad1064c841a5e2d354ed7f8a16bdbcc18d789a15)
- See also UPB changes below, which may affect Rust.
Python
- Ensure that we always invalidate map iterators when the message is mutated with
MergeFrom()orCopyFrom(). (https://github.com/protocolbuffers/protobuf/commit/0dce42152c4731381de1d5dbe990ce97e40dde95) - Python: don't emit ClassVar for a file's top-level extensions (#29222) (https://github.com/protocolbuffers/protobuf/commit/c0fd602b1750505a3a4300f9120814952a9f9276)
- Fix RepeatedCompositeContainer.add() to initialize the new message before attaching to the parent. (https://github.com/protocolbuffers/protobuf/commit/b824e666d656e30619988a3ef6ff1ed90f7afdb5)
- Python: Timestamp and Duration FromSeconds, FromMilliseconds, FromMicroseconds and FromNanoseconds now accept floats, rounded to the nearest nanosecond. NaN and infinity raise ValueError. (https://github.com/protocolbuffers/protobuf/commit/2e823d2e3564a0e1caea07c55ddfe70812e5fa3b)
- Avoid EncodeError when ByteSize is called on message missing required fields (https://github.com/protocolbuffers/protobuf/commit/d3fa262bf2a57a12064e55c86355deb0f5792b97)
- Propagate Python C API failures in message field and dynamic attribute handling (#29854) (https://github.com/protocolbuffers/protobuf/commit/90229ff86e5e652a2e38753c7060583fe0879ddf)
- Fix PyFileDescriptor creation data race under free-threading. (https://github.com/protocolbuffers/protobuf/commit/c24e4c971ef26088bb8b1c0b82425ebc182f9376)
- Optimize pure Python parse path for custom JSON enum names. (https://github.com/protocolbuffers/protobuf/commit/9d98477ca922253e1db5ec213a188927385d25db)
- [Py/C++] Fixed data race in Python free threading by removing obsolete hack (https://github.com/protocolbuffers/protobuf/commit/1a238308815176a92ba177d598cbdc6aa3b3290d)
- Protocol buffers support being created from memoryviews. (https://github.com/protocolbuffers/protobuf/commit/b43ac42ce03d35da38fbf462ec7c23a01a3e650e)
- Fix messageset conformance for pure Python to match Py-C++ and Py-upb (https://github.com/protocolbuffers/protobuf/commit/02a9c9dec80c8df4363a5c28db602444b0bff7a3)
- Extract Python naming helper functions into a separate
nameslibrary. (https://github.com/protocolbuffers/protobuf/commit/b2e184385f3e10c61721cc7435b094ec8ae2c32a) - Fix(python): reject mismatched CopyToProto targets (#28666) (https://github.com/protocolbuffers/protobuf/commit/b5d2e8db22a5f3a21642a66cb16c3413e56e6598)
- Fix potential Py_DECREF(NULL) crash in PythonMessageMutator destructor. (https://github.com/protocolbuffers/protobuf/commit/44fa35f8607515ce7172ed7e96829cd7e45a71f7)
- Sync sub-objects in PyUpb_Message_MergeFromString even when decode fails. (https://github.com/protocolbuffers/protobuf/commit/414e4142cdc4d43c4eb47f9e4d8b811eeab9d9dc)
PHP
- Validate
nanosrange andDateTimecreation in PHPTimestamp::toDateTime()(https://github.com/protocolbuffers/protobuf/commit/9f37106fe5968a7ed66fd83e34b9cfb1a20037b6) - Validate php_class_prefix and objc_class_prefix in code generators (#29130) (https://github.com/protocolbuffers/protobuf/commit/1e1a0a8c76f2e5dc6ed734439fd79ca90cffe96e)
- Remove total_bytes_limit from pure PHP CodedInputStream. (https://github.com/protocolbuffers/protobuf/commit/ed612a8b43531290e8815820ba79d35379b01a2a)
PHP C-Extension
- Validate
nanosrange andDateTimecreation in PHPTimestamp::toDateTime()(https://github.com/protocolbuffers/protobuf/commit/9f37106fe5968a7ed66fd83e34b9cfb1a20037b6) - See also UPB changes below, which may affect PHP C-Extension.
Ruby
- Ruby: Add
emit_defaultsoption toMessage#to_h(#29761) (https://github.com/protocolbuffers/protobuf/commit/378560d07943bdad626968fd8bf3b2b7fef98477) - Ruby: fix use-after-free of map keys aliasing a temporary String (#29026) (https://github.com/protocolbuffers/protobuf/commit/7d7d6ab836eb8d226f8dcd6ed91efa5ea2cb7fe1)
Ruby C-Extension
- Ruby: Add
emit_defaultsoption toMessage#to_h(#29761) (https://github.com/protocolbuffers/protobuf/commit/378560d07943bdad626968fd8bf3b2b7fef98477) - Fix google-protobuf gem source build on the mswin platform (#28433) (https://github.com/protocolbuffers/protobuf/commit/dce0d24702dff4c9b82cab315757eb0efb7a87b0)
- Ruby: fix use-after-free of map keys aliasing a temporary String (#29026) (https://github.com/protocolbuffers/protobuf/commit/7d7d6ab836eb8d226f8dcd6ed91efa5ea2cb7fe1)
- See also UPB changes below, which may affect Ruby C-Extension.
UPB (Python/PHP/Ruby C-Extension)
- Fix conflicting types for _upb_Message_NextBaseField on 32-bit targets (https://github.com/protocolbuffers/protobuf/commit/3e575b2c6a666c0bafa04542e6b0f4d873a03dbc)
- Optimize upb_Arena memory allocation with inlined block pool. (https://github.com/protocolbuffers/protobuf/commit/0c17ea98f35b5f1940c942a0e54844cc8edc1de8)
- Include .c files in the source_files glob in
upb/port/BUILD(https://github.com/protocolbuffers/protobuf/commit/0f685d6ec9dde3e9835b2fe83b3653267ce865ac) - Fix macro order in alloc.h and check upb_DefPool_AddFile return value in lua/def.c (https://github.com/protocolbuffers/protobuf/commit/9990e5083eab6a66b1398172b537cc085270496d)
- Fix: UPB JSON encoding for FieldMask (https://github.com/protocolbuffers/protobuf/commit/30f89bfe7b89250739bc05491cfcc68029a930ca)
- Check sub array bounds before indexing in upb_MiniTable_Link (#28553) (https://github.com/protocolbuffers/protobuf/commit/085b305c258b549582466481667f2d7104a05855)
- Fix: [upb] roll back extensions after failed file addition (#28900) (https://github.com/protocolbuffers/protobuf/commit/9c66da89e9ddd6c952db0ec638a83ac9d4508f64)
- Upb/message/compare: Add support for partial equality comparisons (https://github.com/protocolbuffers/protobuf/commit/22677ce80de639c60e3ab3a8d746881ca87db77a)
- Fix the behavior of GetOrCreateMutableMessage on fields in oneofs (https://github.com/protocolbuffers/protobuf/commit/ad1064c841a5e2d354ed7f8a16bdbcc18d789a15)
Other
- Upgrade Abseil dependency to 20250814.1. (https://github.com/protocolbuffers/protobuf/commit/f0b5daf8d79497fcdd068367a978913da2ccaaa3)
- Only applying Xcode version config in to our CI and update protobuf repository to use the newest version (v7) of protobuf-ci with this change (https://github.com/protocolbuffers/protobuf/commit/eaa37fad9eee3fe27ffbcb4dee6df1a5ee037fe2)
- Add JSON conformance tests for non-ASCII Unicode digits in quoted numeric fields. (https://github.com/protocolbuffers/protobuf/commit/e5f5e1cc75fb167f923a980514d03c4d62887b2a)
- Fix Lua call sites for upb nodiscard enablement (https://github.com/protocolbuffers/protobuf/commit/7971b3187bd4addad8330876f3de28db22b51d82)
- Add custom option numbers for use by ProtoWire (#28919) (https://github.com/protocolbuffers/protobuf/commit/c27007fc254b3af79dc9a139859cbede31669176)
- Reserve extension numbers 1364-1373 for Flyte (#29013) (https://github.com/protocolbuffers/protobuf/commit/8b350fc1871a62df46300be9215adcb7732e33a5)
- Fix Copybara leak for protobuf and add leakr checks. (https://github.com/protocolbuffers/protobuf/commit/88d6fd37bc2a6ea0d4f4b215ed93175607c861bd)
- Remove csharp from CODEOWNERS assignment (https://github.com/protocolbuffers/protobuf/commit/216b587a1240d9a70f2d6876939a55f7ecf187a4)