~thopiekar/protobuf/+git/protobuf:test_631451788

Last commit made on 2024-05-20
Get this branch:
git clone -b test_631451788 https://git.launchpad.net/~thopiekar/protobuf/+git/protobuf

Branch merges

Branch information

Name:
test_631451788
Repository:
lp:~thopiekar/protobuf/+git/protobuf

Recent commits

2527eed... by Protobuf Team Bot <email address hidden>

Remove `Arena_pin` in favor of adopting the UPB freezing API.

PiperOrigin-RevId: 631451788

01b0b8e... by Protobuf Team Bot <email address hidden>

Added a new public API `bytesUntilLimit` to GPBCodedInputStream.

This simply exposes preexisting logic. This read-only API is for convenience and doesn't reveal any information that was not already available. `[GPBCodedInputStream position]` is already a public API. The `limit` is known to the user because it's specified by them.

PiperOrigin-RevId: 635502694

47f4bc9... by Protobuf Team Bot <email address hidden>

Fix Ruby FFI to pass `MiniTable` to `upb_Message_New()` aka `new_message_from_def()`.

PiperOrigin-RevId: 635226405

1f82080... by Protobuf Team Bot <email address hidden>

Test if a tag with unknown wire type (0x6 or 0x7) causes parsing failures.

PiperOrigin-RevId: 634878920

11c27df... by Sandy Zhang <email address hidden>

Lazily resolve features for proto2 and proto3 for compatibility with old open source gencode that does not invoke feature resolution from gencode static init.

PiperOrigin-RevId: 634804242

5dfdd85... by Protobuf Team Bot <email address hidden>

Auto-generate files after cl/634787159

5b8e90f... by Protobuf Team Bot <email address hidden>

Refactor the way we turn on the optimization in StrongPointer.
Some versions of gcc seem to advertise __cpp_nontype_template_args but not
support the argument in some cases.
Only attempt the template parameter if we are using the optimized .reloc
approach.

Fixes https://github.com/protocolbuffers/protobuf/issues/16868

PiperOrigin-RevId: 634787159

2f3242c... by Protobuf Team Bot <email address hidden>

Fix ClangTidy warnings

- Call std::string::insert to insert a character.
- Use assignment instead of CopyFrom.

PiperOrigin-RevId: 634610391

a521e6e... by Protobuf Team Bot <email address hidden>

Internal chanegs

PiperOrigin-RevId: 634600978

34c843d... by Anton Grbin <email address hidden>

[7392] [cpp] Remove dead code path for map key of type enum in JSON parsing (#16567)

# Changes

Remove dead code path -- we don't allow enums to be map keys ([proto2 spec](https://protobuf.dev/programming-guides/proto2/#maps), [proto3 spec](https://protobuf.dev/programming-guides/proto3/#maps)). In other words the case block `case FieldDescriptor::TYPE_ENUM` is dead code. Potential enum type keys will be caught in `default: return lex.Invalid("unsupported map key type");` block below similar to other unsupported map key types like double.

# Motivation

While working on fixing `IgnoreUnknownEnumStringValueInMap` conformance tests for cpp ([related issue](https://github.com/protocolbuffers/protobuf/issues/7392)) I stumbled upon a bug where we pass the wrong `field` parameter to the enum parsing function.

In this scope:
* the variable `field` is a map field of the message that holds the map. This field is not of enum type, it's a repeated message of map entires.
* the variable `key_field` is the key field of the map message entry. This field is the enum type that we need to parse here.

The function is long, so I clarified it here:

```cpp
template <typename Traits>
absl::Status ParseMap(JsonLexer& lex, Field<Traits> field, Msg<Traits>& msg) {
  (..)
  return lex.VisitObject(
      [&](LocationWith<MaybeOwnedString>& key) -> absl::Status {
          (..)
          return Traits::NewMsg(
            field, msg,
            [&](const Desc<Traits>& type, Msg<Traits>& entry) -> absl::Status {
              auto key_field = Traits::KeyField(type);
              switch (Traits::FieldType(key_field)) {
                (..)
                case FieldDescriptor::TYPE_ENUM: {
                  MaybeOwnedString key_str = key.value;
                  auto e = ParseEnumFromStr<Traits>(lex, key_str, /** bug here **/ field);
```

The correct reference should be `key_field`.

Instead of fixing the bug and leaving the dead code, it's better to remove the dead block alltogether.

Closes #16567

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/16567 from noom:anton--7392--fix-map-key-nit d992b8a2a6c999cdf1559ede9fbf723e15644b30
PiperOrigin-RevId: 634516984