Commit graph

19 commits

Author SHA1 Message Date
Protobuf Team Bot
6a21212800 Hopefully final batch of return value checks before UPB_NODISCARD enforcement
PiperOrigin-RevId: 970967137
2026-08-25 20:13:17 -07:00
Protobuf Team Bot
6165c52793 Validate tag match before treating unlinked submessages as unknown fields.
Otherwise colliding fields will incorrectly end up in unknowns.

PiperOrigin-RevId: 966858004
2026-08-18 16:10:58 -07:00
Protobuf Team Bot
86dfa627be Migrate upb_MessageUnknown calls in upb tests to use upb_Message_NextUnknown2.
PiperOrigin-RevId: 962412486
2026-08-10 15:51:42 -07:00
Ada Zhang
2ac75aab07 Support non-canonical extensions in message copy/freeze/encode operations.
PiperOrigin-RevId: 955260241
2026-07-28 08:04:18 -07:00
Joshua Haberman
beb01ec89a Fix upb wire decoder accepting field number 0.
Reject field_number 0 tags in _upb_WireReader_SkipValueForceInline.
Protocol Buffer wire format requires field numbers to be positive integers
(1 to 536,870,911). Previously, _upb_WireReader_SkipValueForceInline lacked a
(tag >> 3) == 0 check, allowing upb to accept and round-trip illegal field 0
tags in empty messages, unknown groups, and MessageSet items.

PiperOrigin-RevId: 953447806
2026-07-24 10:50:37 -07:00
Protobuf Team Bot
77172ada39 Backport consecutive unknown fields optimization to slow path decoder.
PiperOrigin-RevId: 937606189
2026-06-24 15:58:05 -07:00
Protobuf Team Bot
db3f946168 Fasttable: Handle all valid sizes for delimited fields.
Solves "memory leak" when handling a repeated message field. A new message is allocated prior to the size check; if the size check needs to fallback, that message is "leaked" (though still owned by the arena), resulting in an increase in memory usage.

PiperOrigin-RevId: 936365737
2026-06-22 18:53:33 -07:00
Rachel Goldfinger
9040f41344 Treat mismatched length-delimited repeated Group tags as unknown fields in upb.
PiperOrigin-RevId: 921438940
2026-05-26 06:51:40 -07:00
Jie Luo
f9e028f29f bazel 9 tests for csharp, hpb, objc, php, python, rust and upb
PiperOrigin-RevId: 918164613
2026-05-19 19:58:47 -07:00
Protobuf Team Bot
0c2c195ecb Fasttable: support closed enums.
PiperOrigin-RevId: 918068827
2026-05-19 15:49:26 -07:00
Protobuf Team Bot
d1e231d4b4 Fasttable: Fix recursion depth check.
The fast path parser had an off-by-one error in its recursion depth limit
check (--d->depth == 0 instead of < 0), causing it to fail on messages
at the maximum supported depth.

PiperOrigin-RevId: 917837775
2026-05-19 08:09:23 -07:00
Protobuf Team Bot
4673941f6e Automated rollback of commit 21e9075a06.
PiperOrigin-RevId: 914653834
2026-05-12 22:43:33 -07:00
Ada Zhang
21e9075a06 Automated rollback of commit d9efde4ed1.
PiperOrigin-RevId: 911751127
2026-05-06 22:58:39 -07:00
Protobuf Team Bot
d9efde4ed1 Decode empty messages as unknown fields.
PiperOrigin-RevId: 911649882
2026-05-06 17:57:13 -07:00
Protobuf Team Bot
a2bab33c52 Fasttable: support message fields.
PiperOrigin-RevId: 900831193
2026-04-16 11:41:25 -07:00
Joshua Haberman
202f0e5641 Added upb_EpsCopyInputStream_ReadEphemeral() and removed other functions that it can replace.
- `upb_EpsCopyInputStream_Skip()` is equivalent to calling `upb_EpsCopyInputStream_ReadEphemeral()` and ignoring the returned string view.
- `upb_EpsCopyInputStream_Copy()` is equivalent to calling `upb_EpsCopyInputStream_ReadEphemeral()` and then `memcpy()`-ing the contents manually.

PiperOrigin-RevId: 839759685
2025-12-03 08:08:24 -08:00
Joshua Haberman
287f7f7b5d Fasttable: Added support for repeated fixed fields.
We use a design where a single function handles both repeated and non-repeated, but calls cardinality helpers that reduce to nothing for the non-repeated case.  This lets us share much of the repeated field handling code between different field types, and reduces the number of fast parsing functions we need to write.

For the moment we avoid calling any non-inline function to avoid spilling registers in uncommon paths like "arena is out of memory."  We either handle the case entirely inline or we return to fall back to the MiniTable parser.

We can play around with some of these implementation choices once the parser is complete and correct.

PiperOrigin-RevId: 767323516
2025-06-04 16:11:36 -07:00
Joshua Haberman
a9652656f2 Rewrote fixed field decoding for the fasttable parser, and enabled it.
This represents the style we will use for fast parsing functions going
forward.  Code is no longer in macros.

Also added tracing to the decoder so that unit tests can verify that functions are actually getting parsed with the fasttable decoder.

PiperOrigin-RevId: 764939946
2025-05-29 17:03:31 -07:00
Joshua Haberman
d37d6beb7b Added more fine-grained decoder tests.
We now test each field type separately, and benchmark them separately too.

PiperOrigin-RevId: 764546791
2025-05-28 21:15:57 -07:00