FasterXML / jackson-dataformats-binary

Uber-project for standard Jackson binary format backends: avro, cbor, ion, protobuf, smile
Apache License 2.0
310 stars 133 forks source link

Fix issue 464: Add multiple checking condition to avoid IOOBE #465

Closed arthurscchan closed 8 months ago

arthurscchan commented 8 months ago

This PR provides a suggested fix for #464 by adding multiple checking conditions for the array index and buffer length in the CBORParser::_finishShortText() method to avoid malformed length value (negative value or value too large) causing infinite while loop and result in AIOOBE.

cowtowncoder commented 8 months ago

Thank you @arthurscchan ! I tweaked this a bit, finding the root cause (int overflow when calculating amount of input/output space needed).