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

issue with parsing negative numbers with no digit before the decimal point #782

Closed
pjfanning opened this issue Jun 24, 2022 · 3 comments
Closed
Assignees

Comments

@pjfanning
Copy link
Member

An example is '-.125'. This is not valid in standard JSON but jackson has JsonReadFeature.ALLOW_LEADING_DECIMAL_POINT_FOR_NUMBERS to allow it. The feature works for positive numbers but not for negative numbers.

See #777 and #781 for failing tests

@cowtowncoder
Copy link
Member

Was able to solve the case for UTF8StreamJsonParser, code differs a bit with others but hope to do the same.
This will also include + in getText() (at least for the case I fixed).

@cowtowncoder
Copy link
Member

UTF8DataInputJsonParser similar to UTF8StreamJsonParser so fixing that easy too.
Tricky case is ReaderBasedJsonParser since it tries to optimize things, trying to reuse input buffer (that is, avoid use of TextBuffer) and then has to worry about buffer boundary conditions.

@cowtowncoder
Copy link
Member

Was able to fix reader case easily as well.

But looking at code I am fairly certain that it won't work for all cases, especially with buffer boundary conditions.
I think I'll try to extend tests to try to catch such cases, although I guess Fuzz-testing would work best for stuff like this.

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

No branches or pull requests

2 participants