Skip to content

Commit 84e81cf

Browse files
mkruskal-googlecopybara-github
authored andcommitted
Make Java-lite reject unmatched end-group tag.
This brings it into conformance with our spec and other languages. PiperOrigin-RevId: 702432195
1 parent 8f6afdc commit 84e81cf

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

conformance/failure_list_java_lite.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,3 @@
66

77
Required.*.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE # Should have failed to parse, but didn't.
88
Required.*.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE # Should have failed to parse, but didn't.
9-
Required.*.ProtobufInput.UnmatchedEndGroup # Should have failed to parse, but didn't.
10-
Required.*.ProtobufInput.UnmatchedEndGroupUnknown # Should have failed to parse, but didn't.
11-
Required.*.ProtobufInput.UnmatchedEndGroupWithData # Should have failed to parse, but didn't.
12-
Required.*.ProtobufInput.UnmatchedEndGroupWrongType # Should have failed to parse, but didn't.

java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ final boolean mergeOneFieldFrom(B unknownFields, Reader reader, int currentDepth
9393
addGroup(unknownFields, fieldNumber, toImmutable(subFields));
9494
return true;
9595
case WireFormat.WIRETYPE_END_GROUP:
96+
if (currentDepth == 0) {
97+
throw InvalidProtocolBufferException.invalidEndTag();
98+
}
9699
return false;
97100
default:
98101
throw InvalidProtocolBufferException.invalidWireType();

0 commit comments

Comments
 (0)