Closed Bug 312351 Opened 20 years ago Closed 20 years ago

The statement RegExp(null) crashes Firefox

Categories

(Core :: JavaScript Engine, defect, P1)

x86
Windows XP
defect

Tracking

()

VERIFIED FIXED
mozilla1.8rc1

People

(Reporter: drimbk, Assigned: mrbkap)

Details

(Keywords: crash, verified1.8)

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1 When passing null to RegExp constructor, the browser crashes. Reproducible: Always Steps to Reproduce: 1. Evaluate RegExp(null) in the JavaScript console or put it in <script> node in a HTML page. Actual Results: crash Expected Results: Perhaps construct the regexp /^$/ ? so it'll match only empty strings. Tested on Ff 1.0.7 and 1.5b2, Tb 1.0.7. The module is js3250.dll
Yeah, dereferencing NULL is a quick way do that. Safe patch upcoming.
Assignee: general → mrbkap
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.8rc1?
Keywords: crash
Priority: -- → P1
Target Milestone: --- → mozilla1.8rc1
Status: NEW → ASSIGNED
Whiteboard: [patch]
Attachment #199451 - Flags: review?(brendan)
Comment on attachment 199451 [details] [diff] [review] No dereferencing null, please! r=shaver
Attachment #199451 - Flags: review?(brendan) → review+
Fix checked into trunk.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Whiteboard: [patch]
Comment on attachment 199451 [details] [diff] [review] No dereferencing null, please! This is a very trivial fix for an easy-to-hit crasher. It is a simple null-check. The fix only affects callers of the RegExp constructor as a function with only one argument, which is null.
Attachment #199451 - Flags: approval1.8rc1?
Attachment #199451 - Flags: approval1.8rc1? → approval1.8rc1+
Checking in regress-312351.js; /cvsroot/mozilla/js/tests/ecma_3/RegExp/regress-312351.js,v <-- regress-312351.js initial revision: 1.1 done
Flags: testcase+
since brendan already approved the patch, fixing up the blocker flag.
Flags: blocking1.8rc1? → blocking1.8rc1+
Fix checked into MOZILLA_1_8_BRANCH.
Keywords: fixed1.8
no crash firefox 1.5 rc2 winxp/linux
Keywords: fixed1.8verified1.8
v 1.8.0.1, 1.8, 1.9a1 20060217 win/linux/mac nightlies
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: