[
https://issues.apache.org/jira/browse/CURATOR-571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Václav Haisman updated CURATOR-571:
-----------------------------------
Affects Version/s: 4.3.0
> PathUtils.validatePath() allows \u001f (unit separator)
> -------------------------------------------------------
>
> Key: CURATOR-571
> URL: https://issues.apache.org/jira/browse/CURATOR-571
> Project: Apache Curator
> Issue Type: Bug
> Components: Client
> Affects Versions: 4.2.0, 4.3.0
> Reporter: Václav Haisman
> Priority: Major
>
> [This piece of code in
> PathUtils.java|https://github.com/apache/curator/blob/master/curator-client/src/main/java/org/apache/curator/utils/PathUtils.java#L92-L95]
> seems to use odd ranges for disallowed characters:
> {code:java}
> } else if (c > '\u0000' && c < '\u001f'
> || c > '\u007f' && c < '\u009F'
> || c > '\ud800' && c < '\uf8ff'
> || c > '\ufff0' && c < '\uffff') {code}
> I can understand that 0 is disallowed by earlier condition in the code. But
> why is 0x1f (unit separator) allowed? Maybe the author wanted to use
> {{c<='\u001f'}}? Similarly, the term of the next condition allows 0x7f. And
> the same goes for the other two ranges.
> Either I am missing something here and the ranges are somehow OK, or I am
> right and the ranges are wrong and should include the boundaries.
> I would expect the following test to pass but they don't, except the first
> one:
> {code:java}
> @Test
> public void testPathUtilsInCurator() {
> PathUtils.validatePath("/test");
> }
> @Test(expected = IllegalArgumentException.class)
> public void testPathUtils0x1f() {
> PathUtils.validatePath("/test\u001f");
> }
> @Test(expected = IllegalArgumentException.class)
> public void testPathUtils0x7f() {
> PathUtils.validatePath("/test\u007f");
> }
> @Test(expected = IllegalArgumentException.class)
> public void testPathUtils0xffff() {
> PathUtils.validatePath("/test\uFFFF");
> } {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)