-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 265870.534@safari-7616-branch (3be7816). https://bugs.web…
…kit.org/show_bug.cgi?id=261289 Bad jsCast<>() in copyDataFromJSArrayToBuses() in AudioWorkletProcessor.cpp https://bugs.webkit.org/show_bug.cgi?id=261289 rdar://115042475 Reviewed by Ryosuke Niwa. Use jsDynamicCast<>() instead of jsCast<>() in AudioWorkletProcessor.cpp for safety. * LayoutTests/webaudio/audioworklet-bad-array-type-expected.txt: Added. * LayoutTests/webaudio/audioworklet-bad-array-type.html: Added. * LayoutTests/webaudio/bad-array-type-processor.js: Added. (CustomProcessor.prototype.process): (CustomProcessor): * Source/WebCore/Modules/webaudio/AudioWorkletProcessor.cpp: (WebCore::toJSArray): (WebCore::toJSObject): (WebCore::copyDataFromJSArrayToBuses): (WebCore::AudioWorkletProcessor::process): Canonical link: https://commits.webkit.org/265870.534@safari-7616-branch
- Loading branch information
Showing
4 changed files
with
75 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This test passes if it does not crash. |
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,31 @@ | ||
<body> | ||
<p>This test passes if it does not crash.</p> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.dumpAsText(); | ||
} | ||
|
||
async function runTest() { | ||
const audio_context = new OfflineAudioContext(2, 1, 44100); | ||
await audio_context.audioWorklet.addModule('bad-array-type-processor.js?' + Math.random()); | ||
|
||
const node1 = new AudioWorkletNode(audio_context, 'bad-array-type-processor'); | ||
const node2 = new AudioWorkletNode(audio_context, 'bad-array-type-processor', { | ||
numberOfOutputs: 2, | ||
outputChannelCount: [1, 1] | ||
}); | ||
|
||
const buffer_source = audio_context.createBufferSource(); | ||
buffer_source.buffer = audio_context.createBuffer(1, 1, 44100); | ||
buffer_source.connect(node1).connect(node2).connect(audio_context.destination); | ||
buffer_source.start(); | ||
|
||
await audio_context.startRendering(); | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
} | ||
|
||
runTest(); | ||
</script> | ||
</body> |
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,22 @@ | ||
Array.prototype[1] = [new Float32Array(0x80)]; | ||
|
||
let count = 0; | ||
class CustomProcessor extends AudioWorkletProcessor { | ||
process(inputs, outputs, parameters) { | ||
count++; | ||
|
||
if (count === 2) { | ||
Array.prototype[1] = 0x1234; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
|
||
let processor = null; | ||
registerProcessor('bad-array-type-processor', function (options) { | ||
if (processor !== null) | ||
return processor; | ||
|
||
return processor = new CustomProcessor(options); | ||
}); |
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