Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfBoundsException in parser #10

Closed
pcy190 opened this issue Apr 16, 2021 · 2 comments
Closed

ArrayIndexOutOfBoundsException in parser #10

pcy190 opened this issue Apr 16, 2021 · 2 comments
Assignees
Labels
Milestone

Comments

@pcy190
Copy link
Contributor

pcy190 commented Apr 16, 2021

The parser fails to throw the ParseException when the parser read the unclosed ', the following example input could cause the ArrayIndexOutOfBoundsException:

'c

In detail, when the parser tries to find closed single quotation mark using indexOf function, the iteration variable is not sets corretly in line 79:

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

@UrielCh UrielCh modified the milestones: 2.4.3, 1.3.3 Apr 17, 2021
@UrielCh UrielCh added the bug label Apr 17, 2021
@UrielCh UrielCh self-assigned this Apr 17, 2021
@UrielCh
Copy link
Contributor

UrielCh commented Apr 17, 2021

Merged, and published as V1.3.3

@UrielCh
Copy link
Contributor

UrielCh commented Apr 19, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants