Skip to content

Commit 069f7a4

Browse files
committed
Explicitly assert any changes to the stack address
1 parent 9e5c73b commit 069f7a4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/audio_worklet.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ function createWasmAudioWorkletProcessor(audioParams) {
6464
);
6565
}
6666
stackRestore(oldStackPtr);
67+
68+
#if ASSERTIONS
69+
// Explicitly verify this later in process()
70+
this.ctorOldStackPtr = oldStackPtr;
71+
#endif
6772
}
6873

6974
static get parameterDescriptors() {
@@ -92,6 +97,7 @@ function createWasmAudioWorkletProcessor(audioParams) {
9297
for (i in parameters) stackMemoryNeeded += parameters[i].byteLength + {{{ C_STRUCTS.AudioParamFrame.__size__ }}}, ++numParams;
9398

9499
#if ASSERTIONS
100+
console.assert(oldStackPtr == this.ctorOldStackPtr, 'AudioWorklet stack address has unexpectedly moved');
95101
console.assert(outputViewsNeeded <= this.outputViews.length, `Too many AudioWorklet outputs (need ${outputViewsNeeded} but have stack space for ${this.outputViews.length})`);
96102
#endif
97103

0 commit comments

Comments
 (0)