Skip to content

Commit

Permalink
Increased the size of the error message buffer by 4x, to 511 bytes. (#…
Browse files Browse the repository at this point in the history
…15728)

The previous limit of 127 was causing error messages to get truncated when long identifiers are in use.

This will increase the stack usage of any code that is allocating a `upb_Status` on the stack. If we want to support smaller stacks in the future, we could change `upb_Status` to store its capacity inline, so different users can allocate error buffers with different capacity.

Fixes: #14376
PiperOrigin-RevId: 603136385

Co-authored-by: Joshua Haberman <haberman@google.com>
  • Loading branch information
zhangskz and haberman committed Feb 5, 2024
1 parent 3e99024 commit ab6bcba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ruby/lib/google/protobuf/ffi/ffi.rb
Expand Up @@ -21,7 +21,7 @@ class FFI
Upb_Map_Begin = -1

## Encoding Status
Upb_Status_MaxMessage = 127
Upb_Status_MaxMessage = 511
Upb_Encode_Deterministic = 1
Upb_Encode_SkipUnknown = 2

Expand Down
2 changes: 1 addition & 1 deletion upb/base/status.h
Expand Up @@ -13,7 +13,7 @@
// Must be last.
#include "upb/port/def.inc"

#define _kUpb_Status_MaxMessage 127
#define _kUpb_Status_MaxMessage 511

typedef struct {
bool ok;
Expand Down

0 comments on commit ab6bcba

Please sign in to comment.