Closed
Bug 1296410
Opened 8 years ago
Closed 7 years ago
NULL pointer read [@xul!nsLineLayout::ReflowFrame]
Categories
(Core :: Graphics: Canvas2D, defect, P1)
Tracking
()
RESOLVED
FIXED
mozilla58
People
(Reporter: tsmith, Assigned: ethlin)
References
(Blocks 1 open bug)
Details
(Keywords: crash, csectype-nullptr, testcase, Whiteboard: [fuzzblocker][gfx-noted])
Attachments
(4 files)
8.51 KB,
text/plain
|
Details | |
227 bytes,
text/html
|
Details | |
1.09 KB,
patch
|
Details | Diff | Splinter Review | |
1.16 KB,
patch
|
mstange
:
review+
|
Details | Diff | Splinter Review |
I am only seeing this on windows at the moment. It doesn't seem to be consistent but the attached test case can reproduce the issue. You may need to close the browser between attempts.
FAULTING_SOURCE_FILE: c:\mozilla-central\layout\generic\nslinelayout.cpp
FAULTING_SOURCE_LINE_NUMBER: 945
FAULTING_SOURCE_CODE:
941:
942: if (!isText) {
943: aFrame->Reflow(mPresContext, reflowOutput, *reflowInputHolder, aReflowStatus);
944: } else {
> 945: static_cast<nsTextFrame*>(aFrame)->
946: ReflowText(*this, availableSpaceOnLine,
947: psd->mReflowInput->mRenderingContext->GetDrawTarget(),
948: reflowOutput, aReflowStatus);
949: }
950:
xul!nsLineLayout::ReflowFrame+0x337
xul!nsBlockFrame::ReflowInlineFrame+0x33
xul!nsBlockFrame::DoReflowInlineFrames+0x163
xul!nsBlockFrame::ReflowInlineFrames+0xfa
xul!nsBlockFrame::ReflowLine+0x55
xul!nsBlockFrame::ReflowDirtyLines+0x422
xul!nsBlockFrame::Reflow+0x335
xul!nsBlockReflowContext::ReflowBlock+0x1c7
xul!nsBlockFrame::ReflowBlockFrame+0x50b
xul!nsBlockFrame::ReflowLine+0x44
xul!nsBlockFrame::ReflowDirtyLines+0x422
xul!nsBlockFrame::Reflow+0x335
xul!nsContainerFrame::ReflowChild+0x4d
xul!nsCanvasFrame::Reflow+0x1e2
...
See attached log
Reporter | ||
Comment 1•8 years ago
|
||
I should also mention this is a fuzz blocker on windows.
Updated•8 years ago
|
Flags: in-testsuite?
Assignee | ||
Comment 2•8 years ago
|
||
I can reproduce this problem with layer.acceleration.disabled: true.
Reporter | ||
Updated•8 years ago
|
Whiteboard: [fuzzblocker]
Assignee | ||
Comment 3•8 years ago
|
||
I tested it locally and I noted that the measureText gets zero width while the scale is very large, comparing to the normal case, measureText works fine. But I'm not sure why it causes ReflowFrame problem.
nical, do you have any idea?
Flags: needinfo?(nical.bugzilla)
Assignee | ||
Updated•8 years ago
|
Whiteboard: [fuzzblocker] → [fuzzblocker][gfx-noted]
Comment 4•8 years ago
|
||
(In reply to Ethan Lin[:ethlin] from comment #3)
> nical, do you have any idea?
No idea off hands, sorry.
Flags: needinfo?(nical.bugzilla)
Updated•8 years ago
|
Priority: -- → P1
Assignee | ||
Comment 5•8 years ago
|
||
When setting a large scale and calling MeasureText, cairo fails at 'GetCharWidth' and then gecko gets an invalid drawtarget. I'll see how to fix it.
Assignee: nobody → ethlin
Assignee | ||
Comment 6•8 years ago
|
||
The problem is when we set a large scale to cairo, the logical size of font will be very large. Cairo will fail at GetCharWidth32 [1] and then the status of cairo becomes abnormal. The abnormal backend status causes this crash.
GetCharWidth32 in cairo is added in bug 96041 [2]. I think when GetCharWidth32 fails, we just need to reset the width of char and don't need to change the status.
[1] https://dxr.mozilla.org/mozilla-central/source/gfx/cairo/cairo/src/cairo-win32-font.c#975
[2] https://hg.mozilla.org/mozilla-central/rev/81b50b2f2ece
Attachment #8803799 -
Flags: review?(mstange)
Assignee | ||
Comment 7•8 years ago
|
||
Add crashtest for this bug.
Attachment #8803800 -
Flags: review?(mstange)
Comment 8•8 years ago
|
||
Do you know why the cairo error status causes us to crash?
Comment 9•8 years ago
|
||
Comment on attachment 8803799 [details] [diff] [review]
fix crash
Review of attachment 8803799 [details] [diff] [review]:
-----------------------------------------------------------------
This patch seems ok on its own though.
But there are other places in this code that return errors, we should not be crashing on those either...
Attachment #8803799 -
Flags: review?(mstange) → review+
Updated•8 years ago
|
Attachment #8803800 -
Flags: review?(mstange) → review+
Assignee | ||
Comment 10•8 years ago
|
||
(In reply to Markus Stange [:mstange] from comment #8)
> Do you know why the cairo error status causes us to crash?
We call 'PresShell::CreateReferenceRenderingContext()' [1] to create gfxContext and then enter 'gfxContext::CreateOrNull' [2]. The error status of cairo makes the return value of 'aTarget->IsValid()' is false. So we get null gfxContext. When trying to get the drawtarget from the gfxContext [3], we'll have crash.
I tried to check if gfxContext is nullptr at [3], but gecko will still crash at another place.
[1] https://dxr.mozilla.org/mozilla-central/source/layout/base/nsPresShell.cpp#2974
[2] https://dxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxContext.cpp?q=%2Bfunction%3A%22gfxContext%3A%3ACreateOrNull%28mozilla%3A%3Agfx%3A%3ADrawTarget+%2A%2C+const+mozilla%3A%3Agfx%3A%3APoint+%26%29%22&redirect_type=single#88
[3] https://dxr.mozilla.org/mozilla-central/source/gfx/src/nsRenderingContext.h?q=%2Bfunction%3AnsRenderingContext%3A%3AGetDrawTarget%28%29&redirect_type=single#35
Yes, sometimes the error handling/fault tolerance is a deep stack, and fixing one place pops up the bug/crash in another place. We should still fix the places we find.
Comment 12•8 years ago
|
||
Comment on attachment 8803799 [details] [diff] [review]
fix crash
Jeff had some more thoughts on this.
Attachment #8803799 -
Flags: review+ → review?(jmuizelaar)
Comment 13•8 years ago
|
||
Ethan, can you track down how the status is getting into the cairo context? It seems reasonable for us to mark the scaled font as bad, but we should avoid having bad scaled fonts make our cairo_t go bad. There are other places where this function can return a bad status so it would be good to make sure we don't run into the same problem those ways.
Comment hidden (obsolete) |
Assignee | ||
Comment 16•7 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM] from comment #15)
> Ethan, are you still working on this bug?
No, I just tried and I cannot reproduce this problem on current release and nightly.
Flags: needinfo?(ethlin)
Assignee | ||
Updated•7 years ago
|
Attachment #8803799 -
Flags: review?(jmuizelaar)
Assignee | ||
Comment 17•7 years ago
|
||
I think we still can land the crashtest.
Assignee | ||
Comment 18•7 years ago
|
||
Comment 19•7 years ago
|
||
Pushed by ethlin@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/eece8c1550bb
Add crashtest for the bug about NULL pointer read when opening a canvas html. r=mstange
Comment 20•7 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox58:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Updated•7 years ago
|
Comment 21•7 years ago
|
||
mozregression says this got fixed somewhere in https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=a551f534773cf2d6933f78ce7d82a7a33a99643e&tochange=c724ae8bb7b867b6bc65efa1049c0322457ff4b0.
Given that we're not really fuzzing Beta with Grizzly, I'm not going to bother backporting the crashtest.
You need to log in
before you can comment on or make changes to this bug.
Description
•