Skip to content

Commit

Permalink
Fix #176 for 2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 31, 2014
1 parent 1a9cc45 commit 5a7f8d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Version: 2.3.5 (xx-xxx-2014)

#152: Exception for property names longer than 256k
#173: An exception is thrown for a valid JsonPointer expression
#176: `JsonPointer` should not consider "00" to be valid index

------------------------------------------------------------------------
=== History: ===
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/com/fasterxml/jackson/core/JsonPointer.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,21 @@ public JsonPointer tail() {

private final static int _parseIndex(String str) {
final int len = str.length();
// [Issue#133]: beware of super long indexes; assume we never
// [core#133]: beware of super long indexes; assume we never
// have arrays over 2 billion entries so ints are fine.
if (len == 0 || len > 10) {
return -1;
}
for (int i = 0; i < len; ++i) {
char c = str.charAt(i);
// [core#176]: no leading zeroes allowed
char c = str.charAt(0);
if (c <= '0') {
return (len == 1 && c == '0') ? 0 : -1;
}
if (c > '9') {
return -1;
}
for (int i = 1; i < len; ++i) {
c = str.charAt(i);
if (c > '9' || c < '0') {
return -1;
}
Expand Down

0 comments on commit 5a7f8d7

Please sign in to comment.