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

Issue 1773433002: Fix use-after-free in gfx::Image. (Closed)

Created:
4 years, 9 months ago by Matt Giuca
Modified:
4 years, 9 months ago
Reviewers:
Robert Sesek
CC:
rsesek+watch_chromium.org, chrome-app-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix use-after-free in gfx::Image. ToImageSkia, ToUIImage and ToNSImage would insert an ImageRep into the map, then return the pointer to the ImageRep. If the map already contained a rep of that type, the new rep gets freed and the returned pointer is dangling. Adds a CHECK for this case so it will now crash cleanly. This should not happen, but it is evidently possible. This could mean that ToImageSkia is being called from two threads at the same time (which is bad, because gfx::Image is not thread safe). BUG=590882 Committed: https://crrev.com/7e551c12da627989bf8f31afd7b671279113d92d Cr-Commit-Position: refs/heads/master@{#381141}

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+8 lines, -2 lines) Patch
M ui/gfx/image/image.h View 1 chunk +2 lines, -1 line 0 comments Download
M ui/gfx/image/image.cc View 1 chunk +6 lines, -1 line 0 comments Download

Dependent Patchsets:

Messages

Total messages: 10 (5 generated)
Matt Giuca
Alternative to https://codereview.chromium.org/1769433002/. The discussion on the bug pointed at the DCHECK-and-move-on being the wrong ...
4 years, 9 months ago (2016-03-07 05:55:10 UTC) #2
Robert Sesek
LGTM. I think this fix is better because it'll hopefully ferret out the thread-unsafe usage ...
4 years, 9 months ago (2016-03-14 17:19:44 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1773433002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1773433002/1
4 years, 9 months ago (2016-03-14 23:44:03 UTC) #6
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 9 months ago (2016-03-15 00:57:09 UTC) #8
commit-bot: I haz the power
4 years, 9 months ago (2016-03-15 00:58:12 UTC) #10
Message was sent while issue was closed.
Patchset 1 (id:??) landed as
https://crrev.com/7e551c12da627989bf8f31afd7b671279113d92d
Cr-Commit-Position: refs/heads/master@{#381141}

Powered by Google App Engine
This is Rietveld 408576698