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

IonReader.next() throws ArrayIndexOutOfBoundsException for some corrupt content #473

Closed
cowtowncoder opened this issue Jan 25, 2024 · 4 comments · Fixed by #482
Closed
Labels
2.17 fuzz Issue found by OssFuzz ion

Comments

@cowtowncoder
Copy link
Member

(note: OSS-Fuzz sourced from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66131)

Looks like there's a code path that produces AIOOBE for corrupt content, with stack trace of:

 	== Java Exception: java.lang.ArrayIndexOutOfBoundsException: Index 16 out of bounds for length 16
	 at com.amazon.ion.impl.IonCursorBinary.uncheckedNextToken(IonCursorBinary.java:1571)
	 at com.amazon.ion.impl.IonCursorBinary.nextValue(IonCursorBinary.java:1714)
	 at com.amazon.ion.impl.IonReaderContinuableCoreBinary.nextValue(IonReaderContinuableCoreBinary.java:460)
	 at com.amazon.ion.impl.IonReaderContinuableApplicationBinary.nextValue(IonReaderContinuableApplicationBinary.java:942)
	 at com.amazon.ion.impl.IonReaderContinuableTopLevelBinary.handleIncompleteValue(IonReaderContinuableTopLevelBinary.java:150)
	 at com.amazon.ion.impl.IonReaderContinuableTopLevelBinary.next(IonReaderContinuableTopLevelBinary.java:166)
	 at com.fasterxml.jackson.dataformat.ion.IonParser.nextToken(IonParser.java:657)
	 at com.fasterxml.jackson.core.JsonParser.nextTextValue(JsonParser.java:1161)

@cowtowncoder cowtowncoder added ion fuzz Issue found by OssFuzz 2.17 labels Jan 25, 2024
@cowtowncoder
Copy link
Member Author

Unable to reproduce at this point; most code paths / call sequences produce proper IonException.
Will try to tweak test case bit more to reproduce.

@cowtowncoder
Copy link
Member Author

@tgregg This is for the 3rd OSS-Fuzz reported new-or-recycled issue, I was unable to reproduce.

@arthurscchan Maybe you can reproduce this issue? Idea is to reproduce but not add defensive programming yet, to let ion-java developers to handle at appropriate level

@tgregg
Copy link
Contributor

tgregg commented Jan 27, 2024

#477 tweaks the test case to reproduce the problematic stack trace.

@cowtowncoder
Copy link
Member Author

Test now fails properly. Thank you @tgregg !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.17 fuzz Issue found by OssFuzz ion
Projects
None yet
2 participants