Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Issue 1358643002: Fix caching bug in JPEGImageDecoder (Closed)

Created:
5 years, 3 months ago by scroggo
Modified:
5 years, 3 months ago
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Fix caching bug in JPEGImageDecoder When decoding only the size, update the restart position and clear jpeg_source_mgr's bytes_in_buffer and next_input_byte. If m_data gets collapsed (outside of JPEGImageDecoder), these values may no longer be valid, since they may point into a segment which no longer exists. The next call to decode will be forced to call getSomeData from the restart position. Add a test which fails without the fix. While the fix does not depend on intimate knowledge of the implementation of SharedBuffer, the test does. In order to ensure that the data in the SharedBuffer gets freed, insert the data into the SharedBuffer using void append(const char*, unsigned) with a length > kSegmentSize, which will force the SharedBuffer to skip its PurgeableVector (m_buffer). After letting JPEGImageDecoder cache a pointer into the SharedBuffer (by calling isSizeAvailable()), collapse the data with a call to data(). BUG=467772 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=202632

Patch Set 1 #

Total comments: 7

Patch Set 2 : Respond to pkasting's comments in patch set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+75 lines, -10 lines) Patch
M Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp View 1 5 chunks +31 lines, -10 lines 0 comments Download
M Source/platform/image-decoders/jpeg/JPEGImageDecoderTest.cpp View 1 1 chunk +44 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (3 generated)
scroggo_chromium
After figuring out crbug.com/530279 (that's a security bug, but you should both have permission to ...
5 years, 3 months ago (2015-09-18 21:07:46 UTC) #2
Peter Kasting
LGTM https://codereview.chromium.org/1358643002/diff/1/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp File Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (right): https://codereview.chromium.org/1358643002/diff/1/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp#newcode428 Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp:428: m_info.src->bytes_in_buffer = 0; On 2015/09/18 21:07:45, scroggo_chromium wrote: ...
5 years, 3 months ago (2015-09-19 00:51:34 UTC) #3
scroggo_chromium
https://codereview.chromium.org/1358643002/diff/1/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp File Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp (right): https://codereview.chromium.org/1358643002/diff/1/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp#newcode428 Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp:428: m_info.src->bytes_in_buffer = 0; On 2015/09/19 00:51:34, Peter Kasting wrote: ...
5 years, 3 months ago (2015-09-21 18:21:28 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1358643002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1358643002/20001
5 years, 3 months ago (2015-09-22 13:58:42 UTC) #7
commit-bot: I haz the power
5 years, 3 months ago (2015-09-22 15:31:51 UTC) #8
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=202632

Powered by Google App Engine
This is Rietveld 408576698