SIGN IN SIGN UP

Protocol Buffers - Google's data interchange format

0 0 35 C++

Fixed a few edge cases around depth limits in encode, decode, and compare.

1. The unknown field depth comparison had an off by one error compared with the logic in decode/encode.
2. The functions to limit encode/decode depth were not working properly when the max depth was unset, because the "default" depth was represented as 0 which did not trigger the min operation.
3. The regular (non-"effective") functions `upb_DecodeOptions_GetMaxDepth()` and `upb_EncodeOptions_GetMaxDepth()` are footguns that do not belong in the header (as illustrated by the bug in (2).  So moved them to the source file.

PiperOrigin-RevId: 760911128
J
Joshua Haberman committed
95af41ec9c901f22645679519925baaa71bd2cef
Parent: 4718327
Committed by Copybara-Service <copybara-worker@google.com> on 5/20/2025, 5:04:43 AM