Skip to content

ArrayIndexOutOfBoundsException in parser #67

@pcy190

Description

@pcy190

Same as
netplex/json-smart-v1#10

The code base is at

protected int indexOf(char c, int pos) {
for (int i = pos; pos < len; i++)
if (in[i] == (byte) c)
return i;
return -1;
}

It shouldn't be the pos to be checked less than len. Instead, the i should be checked. The correct way in line 79 is:

for (int i = pos; i < len; i++) 

Any input with unclosed single quotation mark could trigger this. Like the input of 'c, cause the ArrayIndexOutOfBoundsException

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions