Bug 1344732 - libjpeg: Out-of-Bounds Read via unusually long Blocks in MCU
Summary: libjpeg: Out-of-Bounds Read via unusually long Blocks in MCU
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1344218 1344220
Blocks: 1344217
TreeView+ depends on / blocked
 
Reported: 2016-06-10 14:50 UTC by Andrej Nemec
Modified: 2021-02-17 03:43 UTC (History)
22 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-06-13 08:10:09 UTC
Embargoed:


Attachments (Terms of Use)

Description Andrej Nemec 2016-06-10 14:50:50 UTC
A  performance optimization for simple and common cases entails that decode_mcu() calls decode_mcu_fast() to decode a single MCU. A greater speed of the latter function is attributed to the fact that it makes some assumptions that the slower decoding function is not allowed to make. One of these assumptions is that enough data is available in the input buffer, so decode_mcu_fast() does not perform bounds’ checks when reading from the input buffer (via GET_BYTE). Instead, decode_mcu() is responsible for ensuring that the input buffer is big enough for the worst case scenario.

However, the problem is that the estimate does not actually cover the worst case possibility. In specifics, the decode_mcu() assumes a maximum of 128 bytes per block while, actually, blocks with around 438 bytes in length can be crafted. (Note that these 438 bytes are not a proper worst-case estimate but rather just the length the PoC generates.)

External references:

https://wiki.mozilla.org/images/7/77/Libjpeg-turbo-report.pdf

Upstream fix:

https://github.com/libjpeg-turbo/libjpeg-turbo/commit/0463f7c9aad060fcd56e98d025ce16185279e2bc

Comment 1 Andrej Nemec 2016-06-10 14:52:53 UTC
Created libjpeg-turbo tracking bugs for this issue:

Affects: fedora-all [bug 1344218]

Comment 2 Andrej Nemec 2016-06-10 14:53:04 UTC
Created mingw-libjpeg-turbo tracking bugs for this issue:

Affects: fedora-all [bug 1344220]


Note You need to log in before you can comment on or make changes to this bug.