GC: Address rooting hazards in ctypes

RESOLVED FIXED in mozilla23

Status

()

Core
js-ctypes
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jonco, Assigned: jonco)

Tracking

Trunk
mozilla23
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
Created attachment 733902 [details] [diff] [review]
Proposed changes

Address rooting hazards in ctypes as reported by static analysis.

I noticed this is not used by the browser so I deliberately didn't change any interfaces so as not to break external clients.
Attachment #733902 - Flags: review?(terrence)
Comment on attachment 733902 [details] [diff] [review]
Proposed changes

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

This is fine for now. Keep in mind that ctypes is meant to be used from JS: we don't actually expose the C interface to anything outside the tree -- at least not any greater degree than other code we write. The browser code that exposes ctypes as a Component in chrome is in toolkit/components/ctypes/: it's extremely short, so it would probably be worth a read to see which of the CTypes.cpp interfaces are purely internal.

::: js/src/ctypes/CTypes.cpp
@@ +2574,5 @@
>  // Convert jsval 'val' to a C binary representation of CType 'targetType',
>  // storing the result in 'buffer'. This function is more forceful than
>  // ImplicitConvert.
>  JSBool
> +ExplicitConvert(JSContext* cx, jsval val_, HandleObject targetType, void* buffer)

This interface is already using a handle. Maybe see if a HandleValue just works here?
Attachment #733902 - Flags: review?(terrence) → review+
(Assignee)

Comment 2

5 years ago
(In reply to Terrence Cole [:terrence] from comment #1)

Ah, I didn't see where this was used from the browser.

I updated ExplicitConvert().
https://hg.mozilla.org/mozilla-central/rev/f41142af1964
Assignee: nobody → jcoppeard
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.