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

Fixed #434: Add null check before accessing integer size #435

Merged
merged 8 commits into from
Dec 30, 2023

Conversation

arthurscchan
Copy link
Contributor

@arthurscchan arthurscchan commented Dec 27, 2023

This PR fixes #434 by adding a null check before accessing the result returning from the IonReader::getIntegerSize() method and wrap it with a try catch block to handle possible NullPointerException thrown from underlying logics.

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
@arthurscchan arthurscchan marked this pull request as draft December 27, 2023 09:17
@arthurscchan arthurscchan marked this pull request as ready for review December 27, 2023 09:53
@arthurscchan arthurscchan marked this pull request as draft December 27, 2023 11:38
@arthurscchan arthurscchan marked this pull request as ready for review December 27, 2023 13:09
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
@cowtowncoder cowtowncoder changed the title Add null check before accessing integer size Fixed #434: Add null check before accessing integer size Dec 30, 2023
try {
size = _reader.getIntegerSize();
} catch (NullPointerException e) {
// Possible exception
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmh. I assume this is due to invalid/malformer content; and if so, should error out instead of quietly swallowing. Especially since it will fail couple of lines anyway. I can change that.

@cowtowncoder cowtowncoder added ion fuzz Issue found by OssFuzz labels Dec 30, 2023
@cowtowncoder cowtowncoder added this to the 2.17.0 milestone Dec 30, 2023
@cowtowncoder cowtowncoder merged commit bf8d729 into FasterXML:2.17 Dec 30, 2023
4 checks passed
@arthurscchan arthurscchan deleted the 434-fix branch January 17, 2024 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fuzz Issue found by OssFuzz ion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected NullPointerException thrown from IonParser::getNumberType()
3 participants