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

Fix issue where the parser can read back old number state when parsing later numbers #1391

Merged
merged 9 commits into from
Jan 27, 2025

Conversation

pjfanning
Copy link
Member

@pjfanning pjfanning commented Jan 25, 2025

@pjfanning pjfanning changed the title Lazy eval 2.17 fix issue where the parser has a number followed by an int where the int can be misinterpreted when read as a different type Jan 25, 2025
@pjfanning pjfanning changed the title fix issue where the parser has a number followed by an int where the int can be misinterpreted when read as a different type fix issue where the parser can read back old number state when parsing later numbers Jan 25, 2025
@cowtowncoder
Copy link
Member

Ok that sounds reasonable. One reason why I think this fix is not ideal is that it actually does not clear the state unless value is accessed -- so it just covers this specific case and not others. But at the same it is somewhat minimal fix which is a plus for patch releases.

@cowtowncoder cowtowncoder changed the title fix issue where the parser can read back old number state when parsing later numbers Fix issue where the parser can read back old number state when parsing later numbers Jan 27, 2025
@cowtowncoder
Copy link
Member

Hmmmh. Playing with tests, the only fix that has any effect here is in getDoubleValue(), line 864. But it looks like _numberString is actually being cleared via convertNumberToDouble() which calls _getNumberDouble() where _numberString is actually cleared.

I think I'll trim down changes slowly to parts that seem useful in general (namely, immediate return after "convertXxx()" calls). And then look into 2.19 for more general clearing.

@cowtowncoder cowtowncoder merged commit dae16ea into FasterXML:2.17 Jan 27, 2025
5 checks passed
@cowtowncoder
Copy link
Member

Merged all the way to master: for 2.19 and master has clearing of _numberString on reset[Number]() methods as safeguard.

Thank you for test & fix @pjfanning !

@pjfanning pjfanning deleted the lazy-eval-2.17 branch January 27, 2025 09:36
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

Successfully merging this pull request may close these issues.

2 participants