Skip to content

Commit

Permalink
Remove RecursiveGroup test case which doesn't exist in 25.x pre-Editions
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangskz committed Sep 18, 2024
1 parent f000b7e commit b5a7cf7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
20 changes: 0 additions & 20 deletions java/lite/src/test/java/com/google/protobuf/LiteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.google.protobuf.UnittestImportPublicLite.PublicImportMessageLite;
import com.google.protobuf.UnittestLite.ForeignEnumLite;
import com.google.protobuf.UnittestLite.ForeignMessageLite;
import com.google.protobuf.UnittestLite.RecursiveGroup;
import com.google.protobuf.UnittestLite.RecursiveMessage;
import com.google.protobuf.UnittestLite.TestAllExtensionsLite;
import com.google.protobuf.UnittestLite.TestAllTypesLite;
Expand Down Expand Up @@ -2614,17 +2613,6 @@ public void testParseFromBytes_recursiveMessages() throws Exception {
assertThat(thrown).hasMessageThat().contains("Protocol message had too many levels of nesting");
}

@Test
public void testParseFromBytes_recursiveKnownGroups() throws Exception {
byte[] data99 = makeRecursiveGroup(99).toByteArray();
byte[] data100 = makeRecursiveGroup(100).toByteArray();

RecursiveGroup unused = RecursiveGroup.parseFrom(data99);
Throwable thrown =
assertThrows(InvalidProtocolBufferException.class, () -> RecursiveGroup.parseFrom(data100));
assertThat(thrown).hasMessageThat().contains("Protocol message had too many levels of nesting");
}

@Test
@SuppressWarnings("ProtoParseFromByteString")
public void testMaliciousSGroupTagsWithMapField_fromByteArray() throws Exception {
Expand Down Expand Up @@ -3043,12 +3031,4 @@ private static RecursiveMessage makeRecursiveMessage(int num) {
return RecursiveMessage.newBuilder().setRecurse(makeRecursiveMessage(num - 1)).build();
}
}

private static RecursiveGroup makeRecursiveGroup(int num) {
if (num == 0) {
return RecursiveGroup.getDefaultInstance();
} else {
return RecursiveGroup.newBuilder().setRecurse(makeRecursiveGroup(num - 1)).build();
}
}
}
4 changes: 0 additions & 4 deletions src/google/protobuf/unittest_lite.proto
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,3 @@ message RecursiveMessage {
optional RecursiveMessage recurse = 1;
optional bytes payload = 2;
}

message RecursiveGroup {
optional RecursiveGroup recurse = 1 [features.message_encoding = DELIMITED];
}

0 comments on commit b5a7cf7

Please sign in to comment.