Closed
Bug 347330
Opened 20 years ago
Closed 20 years ago
localrootscope in jsxml.c
Categories
(Core :: JavaScript Engine, defect, P1)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla1.8.1beta2
People
(Reporter: guninski, Assigned: mrbkap)
Details
(Keywords: fixed1.8.1, Whiteboard: [baking until 8/6])
Attachments
(1 file)
|
899 bytes,
patch
|
brendan
:
review+
mtschrep
:
approval1.8.1+
|
Details | Diff | Splinter Review |
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.
| Reporter | ||
Updated•20 years ago
|
Product: Firefox → Core
| Reporter | ||
Updated•20 years ago
|
Component: General → JavaScript Engine
| Assignee | ||
Comment 1•20 years ago
|
||
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
| Assignee | ||
Comment 2•20 years ago
|
||
Oh, how I pine for JSAutoLocalRootScope! ;-)
Comment 3•20 years ago
|
||
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?
Comment 4•20 years ago
|
||
This is "just" a leak, not a dangling pointer vulnerability.
/be
Group: security
| Assignee | ||
Comment 5•20 years ago
|
||
Checked into trunk.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Whiteboard: [baking until 8/6]
| Reporter | ||
Comment 6•20 years ago
|
||
(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 7•20 years ago
|
||
Comment on attachment 232182 [details] [diff] [review]
Fix
a=schrep for drivers.
Attachment #232182 -
Flags: approval1.8.1? → approval1.8.1+
Updated•20 years ago
|
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•