Closed Bug 355052 Opened 18 years ago Closed 18 years ago

Crash [@ NoSuchMethod] [@ js_ComputeThis] with valueOf: gc and __iterator__

Categories

(Core :: JavaScript Engine, defect)

PowerPC
macOS
defect
Not set
critical

Tracking

()

VERIFIED FIXED

People

(Reporter: jruderman, Assigned: brendan)

References

Details

(Keywords: crash, testcase, verified1.8.1, Whiteboard: [sg:critical?] js1.7 feature)

Crash Data

Attachments

(4 files)

js> ( {valueOf: gc} - [function(){}].__iterator__ )() This usually crashes trying to dereference something near zero, but one I saw it jump to 0x20202020 and once I saw it try to dereference 0x80000007.
Here is a simple example: js> ( {valueOf: gc} - [].a )() ( {valueOf: gc} - [].a )() before 9232, after 9232, break 08129000 Segmentation fault (core dumped)
This a bug in the emitter. Consider the following example: var obj = {valueOf: gc }; function f() { ( obj * [].a )(); } dis(f); f(); Before crashing it prints the following bytecode for f: main: 00000: name "obj" 00003: name "Object" 00006: pushobj 00007: newinit 00008: one 00009: initprop "a" 00012: endinit 00013: getprop "a" 00016: mul 00017: group 00018: pushobj 00019: call 0 00022: pop 00023: stop Source notes: 0: 0 [ 0] newline 1: 13 [ 13] xdelta 2: 13 [ 0] pcbase offset 10 4: 19 [ 6] pcbase offset 19 here pushobj at line 18 pushes to the stack the last value of obj register. In this case it is temporary left from getprop 013 which is already GC-ed. Something is badly broken regarding that pushobj.
This a bug in js_EmitTree when it deals with the TOK_LP case. It misses the fact that at line 5792 pn2 can be arbitrary expression.
Regression in patch for bug 320032, which reopened bug 41864. JSOP_GROUP must null the |obj| register if the expression really needed to be parenthesized. This points to the fix: the parser should eliminate the TOK_RP parenthesizing parent of any member expression. /be
Attached patch fixSplinter Review
Assignee: general → brendan
Status: NEW → ASSIGNED
Attachment #240870 - Flags: review?(igor.bukanov)
Comment on attachment 240870 [details] [diff] [review] fix Now it works as expected.
Attachment #240870 - Flags: review?(igor.bukanov) → review+
BTW, Rhino is significantly different from SM regarding implementing call bytecode. There the emitter generates special bytecodes to compute both this and function for all syntactical cases of () operator before calling this. It seems cleaner then various "obj = NULL".
Yes, SpiderMonkey influenced Rhino early on, and didn't keep up with its child ;-) -- file a followup bug? /be
Blocks: js1.7src
Safe fix, candidate for now, or if not, for the patch release. Fixed on trunk: Checking in jsinterp.c; /cvsroot/mozilla/js/src/jsinterp.c,v <-- jsinterp.c new revision: 3.295; previous revision: 3.294 done Checking in jsparse.c; /cvsroot/mozilla/js/src/jsparse.c,v <-- jsparse.c new revision: 3.252; previous revision: 3.251 done /be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Flags: blocking1.8.1?
Flags: blocking1.8.1.1?
Resolution: --- → FIXED
Attachment #240870 - Flags: approval1.8.1?
Comment on attachment 240870 [details] [diff] [review] fix Approved for RC2.
Attachment #240870 - Flags: approval1.8.1? → approval1.8.1+
Checking in jsinterp.c; /cvsroot/mozilla/js/src/jsinterp.c,v <-- jsinterp.c new revision: 3.181.2.67; previous revision: 3.181.2.66 done Checking in jsparse.c; /cvsroot/mozilla/js/src/jsparse.c,v <-- jsparse.c new revision: 3.142.2.64; previous revision: 3.142.2.63 done /be
Keywords: fixed1.8.1
The patch for this bug caused bug 355101. /be
Blocks: 355101
Flags: in-testsuite+
Whiteboard: [sg:critical?] js1.7 feature
verified fixed 1.8 1.9 20061002 windows/linux 1.8 macppc
Status: RESOLVED → VERIFIED
Already in 1.8.1, clearning nomination flags.
Group: security
Flags: blocking1.8.1?
Flags: blocking1.8.1.1?
/cvsroot/mozilla/js/tests/js1_7/extensions/regress-355052-01.js,v <-- regress-355052-01.js /cvsroot/mozilla/js/tests/js1_7/extensions/regress-355052-02.js,v <-- regress-355052-02.js /cvsroot/mozilla/js/tests/js1_7/extensions/regress-355052-03.js,v <-- regress-355052-03.js
On the trunk these exceptions have changed from 'TypeError: NaN is not a function' to 'TypeError: - is not a function' for 01, 02 and 'TypeError: * is not a function' for 03. Range is 2006-12-27 to 2006-12-28 and looks like bug 363536. Do we care or should I rewrite the test to handle either case?
These look like regressions to me. Igor? /be
Crash Signature: [@ NoSuchMethod] [@ js_ComputeThis]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: