Closed Bug 327170 Opened 19 years ago Closed 19 years ago

Reuse of RegExp in string.replace(rx.compile(...), function() { rx.compile(...); }) causes a crash

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9alpha1

People

(Reporter: mozilla.nospam, Assigned: mrbkap)

References

()

Details

(4 keywords, Whiteboard: [sg:moderate] potentially reveals memory [patch][rft-dl])

Attachments

(2 files)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 http://www.fatbrain.org/js-bug2.txt for the source-code version. Not much more to say, u fix ;) Reproducible: Always Steps to Reproduce: 1. Create a RegExp object. 2. Run replace function on some string: "teststring".replace(rx.compile("s", "g"), function() { fx.compile("bleh", "g"); }) 3. Crash. Actual Results: Crash
I can reproduce this.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: normal → critical
OS: Windows XP → All
Priority: -- → P1
Hardware: PC → All
Whiteboard: [patch]
Target Milestone: --- → mozilla1.9alpha
Attached patch FixSplinter Review
We need to make sure that we hold a reference to the regular expression while we're using it.
Assignee: general → mrbkap
Status: NEW → ASSIGNED
Attachment #211897 - Flags: superreview?(shaver)
Attachment #211897 - Flags: review?(brendan)
Comment on attachment 211897 [details] [diff] [review] Fix Great, thanks -- r=me. /be
Attachment #211897 - Flags: review?(brendan)
Attachment #211897 - Flags: review+
Attachment #211897 - Flags: approval1.7.13?
Attachment #211897 - Flags: approval-branch-1.8.1+
Attachment #211897 - Flags: approval-aviary1.0.8?
Flags: blocking1.8.1+
Flags: blocking1.7.13?
Flags: blocking-aviary1.0.8?
FMR, not good -- want fixed on branches. /be
Keywords: crash
Flags: blocking1.7.13?
Flags: blocking1.7.13+
Flags: blocking-aviary1.0.8?
Flags: blocking-aviary1.0.8+
Group: security
Whiteboard: [patch] → [sg:moderate] potentially leaks memory [patch]
Comment on attachment 211897 [details] [diff] [review] Fix I think we want this on the 1.8.0 branch.
Attachment #211897 - Flags: approval1.8.0.2?
Flags: blocking1.8.0.2+
Whiteboard: [sg:moderate] potentially leaks memory [patch] → [sg:moderate] potentially reveals memory [patch]
Fix checked into trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Comment on attachment 211897 [details] [diff] [review] Fix approved for old branches, a=dveditz for drivers
Attachment #211897 - Flags: approval1.8.0.2?
Attachment #211897 - Flags: approval1.8.0.2+
Attachment #211897 - Flags: approval1.7.13?
Attachment #211897 - Flags: approval1.7.13+
Attachment #211897 - Flags: approval-aviary1.0.8?
Attachment #211897 - Flags: approval-aviary1.0.8+
Fix checked into the 1.7 branches.
v with today's ff trunk/mozilla 1.7.13 on winxp. i'll v1.0.8 with the regular test run later.
Status: RESOLVED → VERIFIED
Flags: testcase+
v 1.7.13, 1.9a1 20060217 win/linux/mac, still needs checkin on 1.8.0.1 and 1.8 branches.
Fix checked into the 1.8 branches.
Whiteboard: [sg:moderate] potentially reveals memory [patch] → [sg:moderate] potentially reveals memory [patch][rft-dl]
v ff 1.8.0.1/1.8/1.9 20060302 win/linux/mac
Group: security
Checking in regress-327170.js; /cvsroot/mozilla/js/tests/ecma_3/RegExp/regress-327170.js,v <-- regress-327170.js initial revision: 1.1
Keywords: fixed1.8.1
Attachment #211897 - Flags: superreview?(shaver)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: