DATACMNS-1285 - PropertyPath now limits the depth of its parsing to 1000 segments.

This commit is contained in:
Oliver Gierke
2018-04-03 19:01:15 +02:00
parent 6293ff325b
commit 06b0dab536
2 changed files with 33 additions and 0 deletions

View File

@@ -369,6 +369,23 @@ public class PropertyPathUnitTests {
.withMessageContaining("Bar.user");
}
@Test // DATACMNS-1285
public void rejectsTooLongPath() {
String source = "foo.bar";
for (int i = 0; i < 9; i++) {
source = source + "." + source;
}
assertThat(source.split("\\.").length).isGreaterThan(1000);
final String path = source;
assertThatExceptionOfType(IllegalArgumentException.class) //
.isThrownBy(() -> PropertyPath.from(path, Left.class));
}
private class Foo {
String userName;
@@ -403,4 +420,14 @@ public class PropertyPathUnitTests {
private FooBar user;
private Foo _foo;
}
// DATACMNS-1285
private class Left {
Right foo;
}
private class Right {
Left bar;
}
}