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

Uncaught exception in com.fasterxml.jackson.dataformat.cbor.CBORParser._finishShortText #316

Closed
cowtowncoder opened this issue Mar 15, 2022 · 1 comment
Labels
2.17 cbor fuzz Issue found by OssFuzz has-failing-test Indicates that there exists a test case (under `failing/`) to reproduce the issue

Comments

@cowtowncoder
Copy link
Member

cowtowncoder commented Mar 15, 2022

Another OSSFuzz found issue (see https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35979), for which we have a unit test to reproduce (see Fuzz_35979_StringValueTest) but no fix yet.

Input content with 296 bytes (resource /data/clusterfuzz-cbor-35979.cbor) used to trigger a corner condition for 256 bytes (get ArrayIndexOutOfBoundsException): not a security issue but inconvenience when caller may get something other than JsonProcessingException.

Note that input itself is invalid (not valid CBOR, that is); but it should produce properly typed exception upon decoding; not AIOOBE.

More specifically the issue is that the last byte indicates a multi-byte UTF-8 character, but without following bytes: for example, indicating "short" String of 256 bytes encoded, byte at the very last offset indicates it is the starting byte of, say, 3-byte character. Current code does not verify that there are enough bytes left but blindly accesses following 2 bytes (beyond end). So while it would be easy to avoid AIOOBE itself (just add padding of 3 bytes to cover all possible cases), it is important for decoder to actually apply bounds checks to avoid the issue.

@cowtowncoder cowtowncoder added cbor fuzz Issue found by OssFuzz 2.14 has-failing-test Indicates that there exists a test case (under `failing/`) to reproduce the issue labels Mar 15, 2022
cowtowncoder added a commit that referenced this issue Mar 19, 2022
@cowtowncoder cowtowncoder changed the title (cbor) Uncaught exception in com.fasterxml.jackson.dataformat.cbor.CBORParser._finishShortText Uncaught exception in com.fasterxml.jackson.dataformat.cbor.CBORParser._finishShortText Mar 9, 2023
@cowtowncoder cowtowncoder added 2.17 and removed 2.14 labels Jan 23, 2024
@cowtowncoder
Copy link
Member Author

Was fixed earlier, forgot to close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.17 cbor fuzz Issue found by OssFuzz has-failing-test Indicates that there exists a test case (under `failing/`) to reproduce the issue
Projects
None yet
Development

No branches or pull requests

1 participant