Closed Bug 534768 Opened 15 years ago Closed 14 years ago

Crash [@ nsBidiPresUtils::Resolve]

Categories

(Core :: Layout, defect)

x86
All
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla1.9.3a4
Tracking Status
blocking1.9.2 --- needed
status1.9.2 --- .4-fixed
blocking1.9.1 --- needed
status1.9.1 --- .10-fixed

People

(Reporter: jruderman, Assigned: tnikkel)

References

Details

(5 keywords, Whiteboard: [sg:critical?])

Crash Data

Attachments

(5 files)

Variations on bug 429865's crashtest still cause problems.
Attached file testcase 1 (aborts)
###!!! ASSERTION: prev sibling not in line list: 'Not Reached', file layout/generic/nsBlockFrame.cpp, line 4764

###!!! ASSERTION: aFrame is not a descendent of aBlockFrame: 'parent', file layout/base/nsBidiPresUtils.cpp, line 285

###!!! ASSERTION: Can't find frame in lines!: 'hasNext', file layout/base/nsBidiPresUtils.cpp, line 291

###!!! ABORT: comparing iterators over different lists: 'mListLink == aOther.mListLink', file layout/base/../generic/nsLineBox.h, line 704
Attached file testcase 2 (crashes)
###!!! ASSERTION: Should have been cleared: 'mBreakSinks.IsEmpty()', file layout/generic/nsTextFrameThebes.cpp, line 649

###!!! ASSERTION: invalid array index: 'i < Length()', file ../../dist/include/nsTArray.h, line 317

Crash [@ nsBidiPresUtils::Resolve] accessing 0x55555555 (with MallocScribble)
Looking at the first testcase, stripping out all the dynamic stuff, a text frame continuation stays on the firstletter frame's overflow list because of the code here http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsFirstLetterFrame.cpp#205 where we invent a linelayout from nothing, and SetDirtyNextLine gets called on that linelayout, nothing ever comes of the SetDirtyNextLine call because we forget about that linelayout right away.

As a side note, can we assert that nothing is on overflow lists after a flush and/or when entering frame construction (anywhere else?)? I've seen a few Jesse bugs that would have probably been found much quicker if we asserted such.
When we invent a linelayout from nothing, we have to not wrap anything on the line.

Yes, we could assert that nothing is on overflow lists, apart from the above issue which I'm not sure how to fix. But in the past we've tried to survive having content left on overflow lists. Probably we should try to survive it still.
Whiteboard: [sg:critical?]
The SetDirtyNextLine was just a symptom of the real problem, we weren't trying to wrap to another line, the first letter logic was causing the continuation to be created.

I think what we need is to do the same thing as bug 491547 but in nsFirstLetterFrame::Reflow in the case where we create a next-in-flow for a child of a floating letter frame. Normally we'd create a continuation for the textframe child of a floating first letter frame if it might need one ahead of time in nsCSSFrameConstructor::CreateFloatingLetterFrame. But that doesn't correctly detect that this situation needs a continuation, and I don't think in general that it could easily be adapted to be able to handle other dynamic situations.
Attached patch patchSplinter Review
Hopefully this situation only happens on BIDI frames so that we can use nextBidi to insert the continuation where we need to without triggering a reflow command.
Assignee: nobody → tnikkel
Attachment #417662 - Flags: review?(roc)
Attachment #417662 - Flags: review?(smontagu)
Simon, do you want to review this or are you fine with just roc reviewing?
Comment on attachment 417662 [details] [diff] [review]
patch

Apologies for the delay
Attachment #417662 - Flags: review?(smontagu) → review+
I remembered that I wanted to look into this more. Turns out you don't need any BIDI to trigger the condition of needing to create a continuation for a textframe inside a floating first-letter frame. A block with floating first-letter style that contains only a space followed by a character that is not punctuation, not a space, and not alphanumeric will do it. So the "should only get here with bidi frames" assertion will fire.

We need to use the nextBidi listname when inserting the continuation so that we don't try to issue a another reflow from inside a reflow. So I propose removing the assertion and making it clear in a comment that the listname nextBidi is bogus but necessary.
Sounds good to me. Please do that and let's get this fixed!
Made those changes and landed
http://hg.mozilla.org/mozilla-central/rev/aff1d6e46f2c
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a4
blocking1.9.1: --- → ?
blocking1.9.2: --- → ?
Can we get a crashtest, as well as branch patches worked up?
blocking1.9.1: ? → needed
blocking1.9.2: ? → needed
OS: Mac OS X → All
What do you mean by "get a crashtest"? For security bugs the procedure I've been using is to set "in-testsuite?", and then when the bug is opened the testcase can be landed. Is there a better way I should be handling it?
Attached patch 1.9.2 patchSplinter Review
Enough changes that I liked a second set of eyes on this.

The extra queryframe stuff is needed because nsIFrame and nsIFrameDebug (gone on m-c) make it ambiguous otherwise.
Attachment #434362 - Flags: review?(roc)
Attached patch 1.9.1 patchSplinter Review
Attachment #434363 - Flags: review?(roc)
Attachment #434362 - Flags: approval1.9.2.3?
Attachment #434363 - Flags: approval1.9.1.10?
(In reply to comment #13)
> What do you mean by "get a crashtest"? For security bugs the procedure I've
> been using is to set "in-testsuite?", and then when the bug is opened the
> testcase can be landed. Is there a better way I should be handling it?

Not landing the test and using "in-testsuite?" is great, that's what we want for security bugs. However, we do like to have the test in hand, both so your reviewer can review it (does it have sufficient coverage,  etc) and so QA can manually apply it to their trees and test with it.
Comment on attachment 434362 [details] [diff] [review]
1.9.2 patch

Approved for 1.9.2.4, a=dveditz for release-drivers
Attachment #434362 - Flags: approval1.9.2.4? → approval1.9.2.4+
Comment on attachment 434363 [details] [diff] [review]
1.9.1 patch

Approved for 1.9.1.10, a=dveditz for release-drivers
Attachment #434363 - Flags: approval1.9.1.10? → approval1.9.1.10+
In this case the test is just the two testcases in this bug imported into the tree as crashtests. So the reviewer can see them and QA can load them directly without needing to apply anything.
Verified for 1.9.2 using the two attached tests. Aborts and crashes (respectively) on 1.9.2.3 but has no problems with my build from today (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4pre) Gecko/20100407 Lorentz/3.6.4pre (.NET CLR 3.5.30729)).

Verified for 1.9.1 the same way with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.10pre) Gecko/20100407 Shiretoko/3.5.10pre (.NET CLR 3.5.30729).
Group: core-security
Added crashtest
http://hg.mozilla.org/mozilla-central/rev/dbd20f123483
Flags: in-testsuite? → in-testsuite+
Crash Signature: [@ nsBidiPresUtils::Resolve]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: