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

NumberFormatException from SnakeYAML due to int overflow for corrupt YAML version #406

Closed
cowtowncoder opened this issue Mar 27, 2023 · 8 comments
Labels
2.15 Fix or feature targeted at 2.15 release oss-fuzz Issue uncovered by oss-fuzz fuzzer yaml Issue related to YAML format backend
Milestone

Comments

@cowtowncoder
Copy link
Member

(note: found by OSS-Fuzz -> https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56902)

Looks like SnakeYAML's YAML directive handling assumes (not unreasonably) that the YAML version should be (or consist of) regular ints. But if input is crafted to have number bigger than 32-bit int, there's a NumberFormatException.
Input OSS-Fuzz generated is:

%YAML 1.9224775801
@cowtowncoder cowtowncoder added yaml Issue related to YAML format backend 2.15 Fix or feature targeted at 2.15 release labels Mar 27, 2023
@cowtowncoder
Copy link
Member Author

@asomov Here's the last open OSS-Fuzz found problem; forgot to follow up on this earlier. I would create an issue at bitbucket but I think project/issues are still locked, so I hope this is enough information?

I will check in Jackson-side reproduction next.

cowtowncoder added a commit that referenced this issue Mar 27, 2023
@asomov
Copy link
Contributor

asomov commented Mar 27, 2023

@cowtowncoder I will create an issue and let you know the progress

@asomov
Copy link
Contributor

asomov commented Mar 27, 2023

@cowtowncoder it will be delivered in version 2.1
https://bitbucket.org/snakeyaml/snakeyaml/pull-requests/60

https://bitbucket.org/snakeyaml/snakeyaml/issues/1061/numberformatexception-from-snakeyaml-due

@cowtowncoder
Copy link
Member Author

Excellent @asomov thank you!

@cowtowncoder cowtowncoder added the oss-fuzz Issue uncovered by oss-fuzz fuzzer label Apr 13, 2023
@cowtowncoder cowtowncoder modified the milestones: 2.15.0, 2.15.3 Aug 25, 2023
@cowtowncoder
Copy link
Member Author

Fixed via #426 for 2.15(.3)

@cowtowncoder
Copy link
Member Author

@asomov With SnakeYAML 2.1, this was fixed for Jackson 2.x. But it looks like snakeyaml-engine 2.6 has the same issue?
This from looking at Jackson YAML format modules failing test. (FuzzYAMLRead_406_56902Test)

@asomov
Copy link
Contributor

asomov commented Aug 27, 2023

@cowtowncoder SnakeYAML Engine 2.7 released with the fix

@cowtowncoder
Copy link
Member Author

Verified: the fix works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.15 Fix or feature targeted at 2.15 release oss-fuzz Issue uncovered by oss-fuzz fuzzer yaml Issue related to YAML format backend
Projects
None yet
Development

No branches or pull requests

2 participants