Closed Bug 265545 Opened 21 years ago Closed 21 years ago

XPCConvert::NativeArray2JS needs to protect newborn array

Categories

(Core :: XPConnect, defect)

defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: dbradley, Assigned: dbradley)

References

Details

(Keywords: fixed-aviary1.0, fixed1.7.5)

Attachments

(1 file)

This function creates an array and then iterates over the native elements potentially create more objects which may leave the newly created array unprotected from GC. There have been crashes through this function ending in JS_SetElemetn where the obj parameter looks to be dead. Solution is to use AUTO_MARK_JSVAL on the array. Patch comming up shortly
I meant JS_SetElement for those searching for a function name. Well and "coming" too but hopefully no one was searching for that. Also timeless has a case where this crashes, so that will be a good test to see if this helps things.
This will protect the JSArray created in XPCConvert::NativeArray2JS. This will protect it until the function returns, it's then the caller's responsibility. And from what I saw the callers do protect it by getting it to someplace safe before any other major calls.
Attachment #162953 - Flags: superreview?(brendan)
Attachment #162953 - Flags: review?(jst)
Comment on attachment 162953 [details] [diff] [review] Protects the newly created JSArray r=jst
Attachment #162953 - Flags: review?(jst) → review+
Lastly if this is sr'd can someone check this in? I haven't gotten a chance to fix my CVS account yet.
Status: NEW → ASSIGNED
Want this on branches NOW. /be
Flags: blocking1.7.x+
Flags: blocking-aviary1.0+
Comment on attachment 162953 [details] [diff] [review] Protects the newly created JSArray sr=me, approving and checking in -- thanks, dbradley. /be
Attachment #162953 - Flags: superreview?(brendan)
Attachment #162953 - Flags: superreview+
Attachment #162953 - Flags: approval1.7.x+
Attachment #162953 - Flags: approval-aviary+
Fixed everywhere. /be
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Blocks: 264577
thanks with this fix our app does not crash when we start it :).
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: