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

Unified Diff: ui/snapshot/snapshot_aura.cc

Issue 2435033002: Fix NULL pointer dereference in FinishedAsyncCopyRequest() (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/snapshot/snapshot_aura.cc
diff --git a/ui/snapshot/snapshot_aura.cc b/ui/snapshot/snapshot_aura.cc
index a3e8166a51d01016f52115efb7b35cb4d3c8ebe7..0f39b1138d58fd3f69fbceb46bd5c298e2909960 100644
--- a/ui/snapshot/snapshot_aura.cc
+++ b/ui/snapshot/snapshot_aura.cc
@@ -53,8 +53,14 @@ static void FinishedAsyncCopyRequest(
// Retry the copy request if the previous one failed for some reason.
if (!tracker->windows().empty() && (retry_count < kMaxRetries) &&
result->IsEmpty()) {
+ // Look up window before calling MakeAsyncRequest. Otherwise, due
+ // to undefined (favorably right to left) argument evaluation
+ // order, the tracker might have been passed and set to NULL
+ // before the window is looked up which results in a NULL pointer
+ // dereference.
+ gfx::NativeWindow window = tracker->windows()[0];
MakeAsyncCopyRequest(
- tracker->windows()[0], source_rect,
+ window, source_rect,
base::Bind(&FinishedAsyncCopyRequest, base::Passed(&tracker),
source_rect, callback, retry_count + 1));
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698