forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent scoped probe parameters from binding to rvalues
Scoped probes are stack-only, so generally retaining references in scoped probes is ok. However, some scoped probes were retaining references to rvalues produced while evaluating constructor arguments, which results in a stack UaF in case such value is referenced outside of `Will(Probe&)` methods. This accepts references passed to probes via std::reference_wrapper<> that does not bind to rvalues and fixes few issues that were detected. Bug: 1475637 Change-Id: I667a761ede9ad75bb3384148a9365b4f088b5d6e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4811809 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Andrey Kosyakov <caseq@chromium.org> Auto-Submit: Andrey Kosyakov <caseq@chromium.org> Reviewed-by: Nate Chapin <japhet@chromium.org> Cr-Commit-Position: refs/heads/main@{#1189098}
- Loading branch information
Showing
9 changed files
with
122 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
// This is a "No Compile Test" suite. | ||
// http://dev.chromium.org/developers/testing/no-compile-tests | ||
|
||
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" | ||
|
||
struct ProbeBase { }; | ||
class TestProbeSink; | ||
|
||
// Generated include should appear after all dependencies. | ||
#include "third_party/blink/renderer/core/probe/test_probes_inl.h" | ||
|
||
namespace blink { | ||
namespace probe { | ||
|
||
#if defined(NCTEST_SCOPED_PROBE_CONSTRUCTOR_CALLED_WITH_RVALUE) // [r"fatal error: no matching constructor for initialization of 'probe::Frobnicate'"] | ||
void WontCompile() { | ||
probe::Frobnicate scoped_probe((String())); | ||
} | ||
#endif | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
settings: { | ||
export_header: "third_party/blink/renderer/core/core_export.h", | ||
export_symbol: "", | ||
include_path: "third_party/blink/renderer/core/inspector", | ||
includes: [ | ||
], | ||
}, | ||
observers: { | ||
DummyObserver: { | ||
probes: [ | ||
"Frobnicate", | ||
] | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
interface TestProbes { | ||
Frobnicate(const String& arg); | ||
} |