Closed Bug 351657 Opened 20 years ago Closed 19 years ago

Invalid JS can make Firefox freeze (until script times out).

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
critical

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: kalle, Unassigned)

Details

Attachments

(2 files)

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.5) Gecko/20060731 Ubuntu/dapper-security Firefox/1.5.0.5 Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.5) Gecko/20060731 Ubuntu/dapper-security Firefox/1.5.0.5 A (relatively small) JS script can make Firefox hang for 5 seconds (or however many the user has defined as the max_script_run_time). Reproducible: Always Steps to Reproduce: 1. Open to-be-attached test case in a browser (online or locally via file:/// -- doesn't matter which). Actual Results: Firefox freezes for max_script_run_time seconds. Expected Results: Firefox's JS interpreter throws an exception about missing semicolon.
Attached file HTML file for test.js. —
I tried to turn the real-life js file into as small and generic a case as possible. While doing so, I realized the problem occurs only when the content within the function is (at least/at most/exactly) a specific size. The script would load as expected a lot of times when I removed stuff, but when I replaced it with e.g. this.prefs="nonsense" instead, the problem remained.
I also realize that I forgot to use the proper name in the .prototype= part (should have used 'foo' but left it as 'sDomParty'), but the problem persists anyway.
I can reproduce using a Mac trunk build, but only if I have the Error Console open. (But I get an indefinite hang, not a 5-second hang until a slow script dialog appears.) I can't reproduce using the js shell (make -f Makefile.ref in mozilla/js/src). I suspect this is a dup of bug 348836.
Now that bug 348836 is fixed in FF2 and 1.5.0.8 has this problem been fixed?
This particular example works for me now. But in general people can be real jerks with JavaScript tricks ("while(true) alert('ha ha!');") and there's not much you can do except stay away from jerks -- just like real life except it's easier to get away with being a jerk.
Group: security
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: