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

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

Created:
4 years, 9 months ago by Matt Giuca
Modified:
4 years, 9 months ago
Reviewers:
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@2661
Target Ref:
refs/pending/branch-heads/2661
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 Review URL: https://codereview.chromium.org/1773433002 Cr-Commit-Position: refs/heads/master@{#381141} (cherry picked from commit 7e551c12da627989bf8f31afd7b671279113d92d) Committed: https://chromium.googlesource.com/chromium/src/+/c275eea4617914c9c2479b2514e2d884643a55a2

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

Messages

Total messages: 2 (1 generated)
Matt Giuca
4 years, 9 months ago (2016-03-22 01:09:06 UTC) #2
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
c275eea4617914c9c2479b2514e2d884643a55a2.

Powered by Google App Engine
This is Rietveld 408576698