Closed Bug 346773 Opened 20 years ago Closed 20 years ago

Crash with misplaced braces in function

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.8.1beta2

People

(Reporter: Waldo, Assigned: mrbkap)

References

Details

(Keywords: crash, verified1.8.1)

Attachments

(2 files)

js> var it = {foo:"5"}; js> it.__iterator__ = function(valsOnly) { var gen = function() { for (var i = 0; i < keys.length; i++) { if (valsOnly) yield vals[i]; else yield [keys[i], vals[i]]; } return gen(); ./js: line 2: 16626 Segmentation fault /home/jwalden/moz/trees/js/mozilla/js/src/Linux_All_DBG.OBJ/js
Obvious copy/paste error.
Assignee: general → mrbkap
Status: NEW → ASSIGNED
Attachment #231531 - Flags: review?(brendan)
OS: Linux → All
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.8.1beta2
Comment on attachment 231531 [details] [diff] [review] Fix copy-paste error Oh, for type-safe format strings! /be
Attachment #231531 - Flags: review?(brendan)
Attachment #231531 - Flags: review+
Attachment #231531 - Flags: approval1.8.1?
Blocks: js1.7
Flags: blocking1.8.1?
Checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Seems like you could have some DEBUG-only code (along with the existing assertions in JS_NewRuntime) that has assertions to check for this problem.
Comment on attachment 231531 [details] [diff] [review] Fix copy-paste error a=drivers, please land this on the MOZILLA_1_8_BRANCH.
Attachment #231531 - Flags: approval1.8.1? → approval1.8.1+
Attached patch how about this? — — Splinter Review
(In reply to comment #4) > Seems like you could have some DEBUG-only code (along with the existing > assertions in JS_NewRuntime) that has assertions to check for this problem. This is a DEBUG-only change, so dbaron feel free to approve for 1.8.1 as well as sr+ -- thanks. /be
Attachment #231544 - Flags: superreview?(dbaron)
Attachment #231544 - Flags: review?(mrbkap)
Comment on attachment 231544 [details] [diff] [review] how about this? >+ * error names enumerated in jscntxt.c. It's not a compiletime check, I'm skeptical of compiletime being one word. Perhaps hyphenate? I wanted to use existing style of the JS engine to point out some nits, but apparently there is little consistency in js/src/ for choosing between prefix and postfix increment or decrement when it doesn't matter. (I prefer prefix.)
Attachment #231544 - Flags: superreview?(dbaron) → superreview+
(In reply to comment #7) > (From update of attachment 231544 [details] [diff] [review] [edit]) > >+ * error names enumerated in jscntxt.c. It's not a compiletime check, > > I'm skeptical of compiletime being one word. Perhaps hyphenate? I merely rewrapped after indenting, vim did the work. This is mccabe's comment, IIRC. Fixed. > I wanted to use existing style of the JS engine to point out some nits, but > apparently there is little consistency in js/src/ for choosing between prefix > and postfix increment or decrement when it doesn't matter. (I prefer prefix.) In C code, for expression-statements or expressions whose value is discarded, it doesn't matter. for loops use i++ in the third part of the head, generally; we are moving toward ++i; for expression statements, just to match Mozilla C++ code style. Was there any other kind of nit you saw? /be
Fixed on trunk and branch. /be
Keywords: fixed1.8.1
Checking in regress-346773.js; /cvsroot/mozilla/js/tests/js1_7/geniter/regress-346773.js,v <-- regress-346773.js initial revision: 1.1
Flags: in-testsuite+
Comment on attachment 231544 [details] [diff] [review] how about this? Yes, please.
Attachment #231544 - Flags: review?(mrbkap) → review+
test case returns error: anonymous generator function returns a value Is that a bug? crash: verified fixed 1.8, 1.9 windows/mac(ppc|tel)/linux
Status: RESOLVED → VERIFIED
(In reply to comment #12) > test case returns error: anonymous generator function returns a value > Is that a bug? In the testcase? Yes. You cannot return e; in a function containing yield expressions. You can fall off the end or return; (equivalently), which will throw StopIteration. /be
(In reply to comment #12) > test case returns error: anonymous generator function returns a value > Is that a bug? To be clear, the crash was caused by attempting to report *this* error. The mismatched braces didn't actually play into the testcase.
Checking in regress-346773.js; /cvsroot/mozilla/js/tests/js1_7/geniter/regress-346773.js,v <-- regress-346773.js new revision: 1.2; previous revision: 1.1 confirmed this version of the test still crashes in 07/31 builds. the return gen() was required for the crash.
Flags: blocking1.8.1?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: