Closed Bug 118849 Opened 24 years ago Closed 24 years ago

calling javascript `Function' with bad args crashes browser

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
critical

Tracking

()

VERIFIED FIXED
mozilla0.9.8

People

(Reporter: dvrsn, Assigned: brendan)

References

()

Details

(Keywords: crash, js1.5)

Attachments

(2 files, 1 obsolete file)

the javascript Function constructor apparently does insufficient argument checking; if the arguments for formal argument names are not strings (e.g. they're numbers) an immediate crash results. The functionBody argument does not have this property.
Confirming on WinNT. OS: Linux --> All. In the current JS shell: js> Function('0') function anonymous() { } js> Function(0); function anonymous() { } js> Function('0', '0') 1: SyntaxError: malformed formal parameter js> Function(0, 0) ---> CRASH! cc'ing Brendan on this JS Engine crash. Will attach stack trace below.
Assignee: rogerl → khanson
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Old norris bug, I think. Patch in a second. /be
Assignee: khanson → brendan
Keywords: js1.5, mozilla0.9.8
Target Milestone: --- → mozilla0.9.8
Status: NEW → ASSIGNED
Hardware: PC → All
I'm working on jsfun.c in the same tree as I used to patch bug 118732. Reviews? Another easy one. /be
Attachment #64055 - Attachment is obsolete: true
Severity: major → critical
Keywords: crash
Testcase added to JS testsuite: mozilla/js/tests/js1_5/Regress/regress-118849.js Currently passing in Rhino, crashing in Spidermonkey -
Comment on attachment 64056 [details] [diff] [review] oops -- last patch was the Call removal one only Looks good. sr=shaver.
Attachment #64056 - Flags: superreview+
Darn, those patches are the same after all. Anyway, still waiting for r=. /be
Attachment #64056 - Flags: review+
Thank you, timeless! I should call you timely. /be
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Marking Verified. The above testcase now passes in both the debug and optimized SpiderMonkey shell -
Status: RESOLVED → VERIFIED
Flags: testcase+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: