Closed Bug 473914 Opened 16 years ago Closed 16 years ago

Crash due to too much recursion in nsCSSScanner::Next with many adjacent comments

Categories

(Core :: CSS Parsing and Computation, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1
Tracking Status
status1.9.1 --- wanted

People

(Reporter: jruderman, Assigned: dbaron)

References

Details

(Keywords: crash, testcase, Whiteboard: [sg:dos] too much stack recursion)

Attachments

(3 files, 1 obsolete file)

No description provided.
OS: Mac OS X → All
Hardware: x86 → All
Assignee: nobody → dbaron
Attached patch patch (obsolete) — Splinter Review
I'll attach a whitespace-ignoring diff of nsCSSScanner.cpp momentarily.
Attachment #357434 - Flags: superreview?(bzbarsky)
Attachment #357434 - Flags: review?(bzbarsky)
Er, the whitespace-ignoring diff of nsCSSScanner.cpp (with less context, thanks to interdiff) is just: --- a/layout/style/nsCSSScanner.cpp +++ b/layout/style/nsCSSScanner.cpp @@ -709,2 +709,3 @@ { + for (;;) { // Infinite loop so we can restart after comments. PRInt32 ch = Read(); @@ -778,3 +779,4 @@ #endif - return SkipCComment() && Next(aToken); + SkipCComment(); + continue; // start again at the beginning } @@ -834,2 +836,3 @@ } +}
Attachment #357434 - Flags: superreview?(bzbarsky)
Attachment #357434 - Flags: superreview-
Attachment #357434 - Flags: review?(bzbarsky)
Attachment #357434 - Flags: review-
Comment on attachment 357434 [details] [diff] [review] patch You need a similar change in NextURL(), right? Also, shouldn't that look like: if (!SkipCComment()) { return PR_FALSE; } continue;
(In reply to comment #3) > You need a similar change in NextURL(), right? Er, yes. I have NextURL massively modified in my tree, so that code isn't there anymore. > Also, shouldn't that look like: > > if (!SkipCComment()) { > return PR_FALSE; > } > continue; Good point.
This removes the bogus comment handling in NextURL that only did anything at the beginning of the URL or after whitespace, and was also broken since it recurred into Next rather than into NextURL.
Attachment #357434 - Attachment is obsolete: true
Attachment #357452 - Flags: superreview?(bzbarsky)
Attachment #357452 - Flags: review?(bzbarsky)
Attached patch patch 2: patchSplinter Review
Updated to comments.
Attachment #357453 - Flags: superreview?(bzbarsky)
Attachment #357453 - Flags: review?(bzbarsky)
Er, and the latter, with interdiff -w, is now: --- a/layout/style/nsCSSScanner.cpp +++ b/layout/style/nsCSSScanner.cpp @@ -709,2 +709,3 @@ { + for (;;) { // Infinite loop so we can restart after comments. PRInt32 ch = Read(); @@ -778,3 +779,6 @@ #endif - return SkipCComment() && Next(aToken); + if (!SkipCComment()) { + return PR_FALSE; + } + continue; // start again at the beginning } @@ -834,2 +838,3 @@ } +}
Attachment #357452 - Flags: superreview?(bzbarsky)
Attachment #357452 - Flags: superreview+
Attachment #357452 - Flags: review?(bzbarsky)
Attachment #357452 - Flags: review+
Attachment #357453 - Flags: superreview?(bzbarsky)
Attachment #357453 - Flags: superreview+
Attachment #357453 - Flags: review?(bzbarsky)
Attachment #357453 - Flags: review+
Status: NEW → RESOLVED
Closed: 16 years ago
Priority: -- → P4
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Flags: in-testsuite+
The crash fix is worth taking on branches?
Flags: blocking1.9.1?
Whiteboard: [sg:dos] too much stack recursion
No, since it's not exploitable and not something anybody is likely to hit due to anything other than artificially-constructed testcases.
per comment 11, not blocking 3.5 release; dunno if we want to get it in a .x release or not.
Flags: wanted1.9.0.x?
Flags: blocking1.9.1?
Flags: blocking1.9.1-
Flags: wanted1.9.0.x? → wanted1.9.0.x+
blocking1.9.1: ? → needed
blocking1.9.1: needed → ---
This is wanted for 1.9.1, but we won't block on it. If someone requests approval on a patch that applies, we'll likely take it.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: