Closed Bug 121658 Opened 23 years ago Closed 23 years ago

too much recursion doesn't unwind

Categories

(Core :: JavaScript Engine, defect)

x86
FreeBSD
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla0.9.9

People

(Reporter: timeless, Assigned: brendan)

References

()

Details

(Keywords: js1.5)

Attachments

(1 file, 1 obsolete file)

timeless@timeless-bsd:~/mozilla/obj-gtk-i386-unknown-freebsd4.4/dist/bin: ./run-mozilla.sh ./xpcshell
Type Manifest File: /home/timeless/mozilla/obj-gtk-i386-unknown-freebsd4.4/dist/bin/components/xpti.dat
nsNativeComponentLoader: autoregistering begins.
nsNativeComponentLoader: autoregistering succeeded
nNCL: registering deferred (0)
js> var i=0;function a(){++i;try{arguments.callee()}catch(e){}}; i=0;a(); print (i); //this doesn't work, but i'd like it to
typein:1: InternalError: too much recursion
js>

<brendan> timeless: when errors-as-exceptions went in, someone failed to look at the "too much recursion" cases and fix the control flow

For my freebsd system, i expect output of 1000 [which appears to be the value of i after the Error]
timeless' example above is:

var i=0;function a(){++i;try{arguments.callee()}catch(e){}}; i=0; a(); print(i);

For my own understanding, note inside the function a(), arguments.callee === a. 
Therefore the example is equivalent to: 

var i=0;function a(){++i;try{a()}catch(e){}}; i=0; a(); print(i);
Patch coming right up.

/be
Status: NEW → ASSIGNED
Keywords: js1.5, mozilla0.9.9
Target Milestone: --- → mozilla0.9.9
Attached patch proposed fix (obsolete) — Splinter Review
Comment on attachment 66360 [details] [diff] [review]
proposed fix

r=rogerl.
There is one other place where the interpreter simply returns JS_FALSE - line
3617 after CHECK_ACCESS has failed - is that a different scenario?
Attachment #66360 - Flags: review+
Thanks, fixed that return JS_FALSE to capture false in ok and goto out.

/be
Attachment #66360 - Attachment is obsolete: true
Comment on attachment 66366 [details] [diff] [review]
patch revised to fix that return that rogerl caught

Recording rogerl's patch.

/be
Attachment #66366 - Flags: review+
Comment on attachment 66366 [details] [diff] [review]
patch revised to fix that return that rogerl caught

Ja. sr=shaver.
Attachment #66366 - Flags: superreview+
Fixed, thanks all.

/be
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Testcase added to JS testsuite:

         mozilla/js/tests/js1_5/Exceptions/regress-121658.js
Verified FIXED.

Before the patch, testcase failed with "InternalError: too much recursion".
Now, testcase passes in debug/optimized JS shells on WinNT, Linux, and Mac9.1.
Status: RESOLVED → VERIFIED
Flags: testcase+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: