Closed Bug 858619 Opened 11 years ago Closed 11 years ago

GC: Address rooting hazards in ctypes

Categories

(Core :: js-ctypes, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(1 file)

Attached patch Proposed changesSplinter Review
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+
(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
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: