forked from chromium/chromium
-
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.
Check if |SavedEvent| exists handling cancel values
In AudioParamTimeline::HandleCancelValues() function, the code expects the |saved_event| pointer from the next event to be non-null. There are corner cases where this is not true. Adding one more check on the saved event pointer fixes the crash. Locally confirmed the attached web test crashes without this fix. Bug: 913217 Test: webaudio/AudioParam/cancel-values-crash-913217.html Change-Id: I4760b939534ef92a2475087540e17c8abc784b3b Reviewed-on: https://chromium-review.googlesource.com/c/1374492 Reviewed-by: Kentaro Hara <[email protected]> Commit-Queue: Hongchan Choi <[email protected]> Cr-Commit-Position: refs/heads/master@{#616107}
- Loading branch information
Showing
3 changed files
with
49 additions
and
2 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
46 changes: 46 additions & 0 deletions
46
third_party/blink/web_tests/webaudio/AudioParam/cancel-values-crash-913217.html
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,46 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title> | ||
Test if canceling events after setTargetAtTime crashes | ||
</title> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<script src="../resources/audit-util.js"></script> | ||
<script src="../resources/audit.js"></script> | ||
</head> | ||
<body> | ||
<script id="layout-test-code"> | ||
// Arbitrary parameters for the offline context. | ||
const sampleRate = 48000; | ||
const renderDuration = 1; | ||
const channels = 2; | ||
const renderFrames = renderDuration * sampleRate; | ||
|
||
const audit = Audit.createTaskRunner(); | ||
|
||
audit.define('crash', (task, should) => { | ||
const context = | ||
new OfflineAudioContext(channels, renderFrames, sampleRate); | ||
const source = context.createConstantSource(); | ||
const analyser = context.createAnalyser(); | ||
source.connect(analyser); | ||
|
||
// Scheduling the following at an earlier time than above causes the | ||
// page to crash in 73.0.3638.0. See crbug.com/913217. | ||
source.offset.setValueAtTime(1, context.currentTime); | ||
source.offset.setTargetAtTime(0, context.currentTime + 2, 0.00001); | ||
source.offset.cancelAndHoldAtTime(context.currentTime + 1.99999); | ||
|
||
source.start(context.currentTime); | ||
|
||
context.startRendering().then(() => { | ||
// Should finish without a crash. | ||
task.done(); | ||
}); | ||
}); | ||
|
||
audit.run(); | ||
</script> | ||
</body> | ||
</html> |