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

Issue 2643943003: Fix stack-use-after-scope in ChromeOS OOBE handler. (Closed)

Created:
3 years, 11 months ago by krasin1
Modified:
3 years, 11 months ago
Reviewers:
xiyuan
CC:
chromium-reviews, alemate+watch_chromium.org, achuith+watch_chromium.org, oshima+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix stack-use-after-scope in ChromeOS OOBE handler. What happens here (before the fix) is the following series of events: 1. display::Screen::GetScreen() returns Screen* pointer 2. Then GetPrimaryDisplay() returns Display value. This value is stored on the stack and has the scope of just this line of the code. After that the compiler is free to reuse the stack space (which it often does) 3. size() is called and returns a reference to a Display field. Once Display goes out of scope (and destroyed), the reference saved in |size| points to an already potentially reused memory, and not to what it meant to refer to. 4. |size| is then used and AddressSanitizer with use-after-scope check correctly points out to the issue. The bug was found by AddressSanitizer with use-after-free check enabled. It's currently being rolled out into Chrome, and this CL is a part of a larger cleanup of existing failures. BUG=649897 Review-Url: https://codereview.chromium.org/2643943003 Cr-Commit-Position: refs/heads/master@{#444812} Committed: https://chromium.googlesource.com/chromium/src/+/d377464c5d3b7aaa13823000932c1a23f3c4d01c

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 12 (7 generated)
krasin1
3 years, 11 months ago (2017-01-19 18:37:32 UTC) #2
xiyuan
lgtm Good finding. C++ is hard. :p
3 years, 11 months ago (2017-01-19 18:48:40 UTC) #5
krasin1
On 2017/01/19 18:48:40, xiyuan wrote: > lgtm > > Good finding. C++ is hard. :p ...
3 years, 11 months ago (2017-01-19 19:02:49 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2643943003/1
3 years, 11 months ago (2017-01-19 19:03:29 UTC) #9
commit-bot: I haz the power
3 years, 11 months ago (2017-01-19 19:14:59 UTC) #12
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://chromium.googlesource.com/chromium/src/+/d377464c5d3b7aaa13823000932c...

Powered by Google App Engine
This is Rietveld 408576698