Bazel 9 upgrade, Any wire transcoding, and coverage tests#2
Merged
Conversation
Move to Bazel 9.1, protobuf 34, and toolbelt 2.0; fix negative int varint encoding, google.protobuf.Any protobuf-wire transcoding, and phaser_library symlink conflicts for transitive protos. Add all_types and stress tests, ASAN config, and native arm64 build flags for Apple Silicon.
- Fix designated-initializer order in generated BankInfo (message_gen.cc) to match the struct declaration so generated code compiles. - Escape backslash/quote bytes in debug string output to match protobuf text format; generalize the protobuf debug-redaction stripping helper. - Fix Any message leaks by taking ownership of bank-allocated messages. - Zero-initialize payload/proto buffers (and test buffers) on allocation and growth to avoid uninitialised-memory reports under valgrind. - Free test buffers/objects in message_test to remove definite leaks. - Upgrade cpp_toolbelt to 2.1.2 (PayloadBuffer::Realloc use-after-free fix). - Add a cross-platform asan config and a Linux valgrind config (with a suppressions file for benign third-party Hexdump reads). - Add GitHub Actions CI: test (Linux+macOS), asan (macOS), valgrind (Linux), all excluding perf_test.
Hexdump reads in 16-byte rows and runs past the end of tightly-sized serialization buffers, which trips a heap-buffer-overflow under ASan (message_test). These were debug-only calls with no assertions, so remove them. Also add a Linux ASan job mirroring the macOS one.
Switching a union from a scalar/enum arm to a string/message arm on a reused message crashed: the scalar arm's Clear() is a no-op and left its bytes in the shared value slot, which the variable-length arm misread as an allocated buffer offset. UnionField::Clear now zeros the slot's buffer offset so the new arm allocates fresh storage. Add MessageTest.UnionArmSwitchInPlace covering in-place arm switching and variable-length shrink (toolbelt ShrinkBlock) on a single message.
ProtoBuffer(std::string_view) does not own its storage, so constructing a reader directly from the temporary returned by AsString() left it with a dangling pointer into the destroyed string. ASan flagged the read in DeserializeVarint. Hold the encoded string in a named local that outlives the ProtoBuffer.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rules_gooverride).int32/int64varint encode/decode inwireformat.h(was breaking protobuf round-trips).google.protobuf.Anyprotobuf-wire transcoding inany.h(in-memory phaser binary unchanged; transcoding at wire boundaries).coverage.protoplusall_types_testandstress_testfor scalars, maps, packed/unpacked repeated fields, imports, and buffer pressure.phaser_librarysymlink conflicts for transitive protos (e.g.Foo.phaser.hfrom multiple targets)..bazelrc: ASAN config (--config=asan), macOS platform flags, native arm64 flags when using--config=apple_silicon(needed when Bazel runs under Rosetta).Test plan
bazelisk test //phaser:all_types_test //phaser:phaser_test //phaser:stress_testbazelisk test //phaser/runtime:message_test //phaser/runtime:wireformat_testbazelisk test //phaser/...(full suite;perf_test~9 min)bazel test //phaser/... --config=asan) — macOS 26 currently hangs at ASan startup locally