Closed Bug 347330 Opened 20 years ago Closed 20 years ago

localrootscope in jsxml.c

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8.1beta2

People

(Reporter: guninski, Assigned: mrbkap)

Details

(Keywords: fixed1.8.1, Whiteboard: [baking until 8/6])

Attachments

(1 file)

localrootscope in jsxml.c not sure this is a bug, so feel free to resolve as as invalid. in jsxml.c js_EnterLocalRootScope and js_LeaveLocalRootScopeWithResult seem balanced on purpose and some nasty bugs mention incorrectly rooted things. in jsxml.c ToXMLList [1] if (!js_EnterLocalRootScope(cx)) return NULL; xml = ParseXMLSource(cx, str); if (!xml) { js_LeaveLocalRootScope(cx); return NULL; } length = JSXML_LENGTH(xml); } listobj = js_NewXMLObject(cx, JSXML_CLASS_LIST); if (listobj) { list = (JSXML *) JS_GetPrivate(cx, listobj); for (i = 0; i < length; i++) { kid = OrphanXMLChild(cx, xml, i); if (!kid) [2] return NULL; so if [1] and [2] get hit (probably due to out of memory) root scope will be not balanced because of the early return. also in jsxml.c GetProperty "goto retry" potentially may disbalance the rootscope. so in case this is exploitable i may try to write a testcase.
Product: Firefox → Core
Component: General → JavaScript Engine
This looks like a bug, though I don't believe it's exploitable. In the worst case, this will result in a massive memory leak: every object allocated after the erroneous call will be reachable according to the GC. I don't believe the goto retry in GetProperty is a problem. There is one goto in the function, which is before the local root scope in the else branch is entered, which means that we cannot goto retry after having pushed our own local root scope. Did I miss something? I'll patch the first issue in a jiffy.
Assignee: nobody → general
OS: Linux → All
Priority: -- → P1
QA Contact: general → general
Hardware: PC → All
Target Milestone: --- → mozilla1.8.1beta2
Attached patch Fix — — Splinter Review
Oh, how I pine for JSAutoLocalRootScope! ;-)
Assignee: general → mrbkap
Status: NEW → ASSIGNED
Attachment #232182 - Flags: review?(brendan)
Comment on attachment 232182 [details] [diff] [review] Fix r=me. E4X, yay. /be
Attachment #232182 - Flags: review?(brendan)
Attachment #232182 - Flags: review+
Attachment #232182 - Flags: approval1.8.1?
This is "just" a leak, not a dangling pointer vulnerability. /be
Group: security
Checked into trunk.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Whiteboard: [baking until 8/6]
(In reply to comment #1) > > I don't believe the goto retry in GetProperty is a problem. There is one goto > in the function, which is before the local root scope in the else branch is > entered, which means that we cannot goto retry after having pushed our own > local root scope. Did I miss something? I'll patch the first issue in a jiffy. > you are right, i seem wrong on the second issue. are there other unbalanced constructs that may lead to troubles?
Comment on attachment 232182 [details] [diff] [review] Fix a=schrep for drivers.
Attachment #232182 - Flags: approval1.8.1? → approval1.8.1+
I checked the fix into the 1.8 branch. /be
Keywords: fixed1.8.1
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: