Closed Bug 868776 Opened 11 years ago Closed 11 years ago

Fix rooting hazards in Web Audio code

Categories

(Core :: Web Audio, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Attached patch Patch (v1) (obsolete) — Splinter Review
Attachment #745571 - Flags: review?(tschneidereit)
Blocks: webaudio
Attached patch Patch (v2)Splinter Review
Attachment #745571 - Attachment is obsolete: true
Attachment #745571 - Flags: review?(tschneidereit)
Attachment #745582 - Flags: review?(tschneidereit)
Comment on attachment 745582 [details] [diff] [review]
Patch (v2)

Review of attachment 745582 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the return value checks added.

::: content/media/webaudio/AudioBuffer.cpp
@@ +99,5 @@
>        const float* data = mSharedChannels->GetData(i);
>        // The following code first zeroes the array and then copies our data
>        // into it. We could avoid this with additional JS APIs to construct
>        // an array (or ArrayBuffer) containing initial data.
> +      JS::RootedObject array(aJSContext, JS_NewFloat32Array(aJSContext, mLength));

Damn, missed this earlier. JS_NewFloat32Array can return NULL, so please check the result here, too.

@@ +137,5 @@
>  {
>    RestoreJSChannelData(aJSContext);
>  
>    MOZ_ASSERT(aChannel < NumberOfChannels());
> +  JS::RootedObject arrayBuffer(aJSContext, JS_NewArrayBufferWithContents(aJSContext, aContents));

And this, too.

@@ +142,1 @@
>    mJSChannels[aChannel] = JS_NewFloat32ArrayWithBuffer(aJSContext, arrayBuffer,

And this.
Attachment #745582 - Flags: review?(tschneidereit) → review+
https://hg.mozilla.org/mozilla-central/rev/e6d7033aeb74
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
Mass moving Web Audio bugs to the Web Audio component.  Filter on duckityduck.
Component: Video/Audio → Web Audio
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: