Closed Bug 1395591 Opened 3 years ago Closed 3 years ago

stylo: Crash near null [@ mozilla::ServoRestyleManager::DoReparentStyleContext]

Categories

(Core :: CSS Parsing and Computation, defect, P2, critical)

defect

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox-esr52 --- unaffected
firefox55 --- unaffected
firefox56 --- unaffected
firefox57 --- fixed

People

(Reporter: truber, Assigned: bzbarsky)

References

(Blocks 2 open bugs)

Details

(Keywords: crash, csectype-nullptr, testcase)

Attachments

(3 files)

Attached file testcase.html
The attached testcase causes a crash near null in m-c rev 20170831-04b6be50a252 with stylo enabled by pref.


==7743==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000020 (pc 0x7f8f0fd8f9e4 bp 0x7ffc288b4a70 sp 0x7ffc288b4880 T0)
==7743==The signal is caused by a READ memory access.
==7743==Hint: address points to the zero page.
    #0 0x7f8f0fd8f9e3 in mozilla::ServoRestyleManager::DoReparentStyleContext(nsIFrame*, mozilla::ServoStyleSet&) /builds/worker/workspace/build/src/layout/base/ServoRestyleManager.cpp:1469
    #1 0x7f8f0fd8f6df in mozilla::ServoRestyleManager::DoReparentStyleContext(nsIFrame*, mozilla::ServoStyleSet&) /builds/worker/workspace/build/src/layout/base/ServoRestyleManager.cpp:1502:7
    #2 0x7f8f0fd8c171 in mozilla::ServoRestyleManager::ReparentStyleContext(nsIFrame*) /builds/worker/workspace/build/src/layout/base/ServoRestyleManager.cpp:1461:3
    #3 0x7f8f0fe0c5c9 in ReparentStyleContext /builds/worker/workspace/build/src/obj-firefox/dist/include/mozilla/RestyleManagerInlines.h:79:3
    #4 0x7f8f0fe0c5c9 in ReparentFrame /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:505
    #5 0x7f8f0fe0c5c9 in ReparentFrames /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:517
    #6 0x7f8f0fe0c5c9 in nsCSSFrameConstructor::WrapFramesInFirstLineFrame(nsFrameConstructorState&, nsIContent*, nsContainerFrame*, nsFirstLineFrame*, nsFrameItems&) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:11512
    #7 0x7f8f0fdf7ffe in AppendFirstLineFrames /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:11552:3
    #8 0x7f8f0fdf7ffe in nsCSSFrameConstructor::ContentAppended(nsIContent*, nsIContent*, bool, bool, TreeMatchContext*) /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.cpp:7914
    #9 0x7f8f0fd4b80e in ContentAppended /builds/worker/workspace/build/src/layout/base/nsCSSFrameConstructor.h:252:5
    #10 0x7f8f0fd4b80e in mozilla::PresShell::ContentAppended(nsIDocument*, nsIContent*, nsIContent*, int) /builds/worker/workspace/build/src/layout/base/PresShell.cpp:4420
    #11 0x7f8f0bdfdd1f in nsNodeUtils::ContentAppended(nsIContent*, nsIContent*, int) /builds/worker/workspace/build/src/dom/base/nsNodeUtils.cpp:167:3
    #12 0x7f8f0acf9278 in nsHtml5TreeOperation::Append(nsIContent*, nsIContent*, nsHtml5DocumentBuilder*) /builds/worker/workspace/build/src/parser/html/nsHtml5TreeOperation.cpp:186:5
    #13 0x7f8f0ad016ca in nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor*, nsIContent**, bool*) /builds/worker/workspace/build/src/parser/html/nsHtml5TreeOperation.cpp:762:14
    #14 0x7f8f0acffae2 in nsHtml5TreeOpExecutor::RunFlushLoop() /builds/worker/workspace/build/src/parser/html/nsHtml5TreeOpExecutor.cpp:466:27
    #15 0x7f8f0ad09e4b in nsHtml5ExecutorFlusher::Run() /builds/worker/workspace/build/src/parser/html/nsHtml5StreamParser.cpp:128:20
    #16 0x7f8f0915b110 in mozilla::SchedulerGroup::Runnable::Run() /builds/worker/workspace/build/src/xpcom/threads/SchedulerGroup.cpp:396:25
    #17 0x7f8f09184d2d in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/workspace/build/src/xpcom/threads/nsThread.cpp:1039:14
    #18 0x7f8f0918a368 in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/workspace/build/src/xpcom/threads/nsThreadUtils.cpp:521:10
    #19 0x7f8f09f1fa66 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/worker/workspace/build/src/ipc/glue/MessagePump.cpp:125:5
    #20 0x7f8f09e8057b in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:326:10
    #21 0x7f8f09e8057b in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:319
    #22 0x7f8f09e8057b in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:299
    #23 0x7f8f0f5e2cff in nsBaseAppShell::Run() /builds/worker/workspace/build/src/widget/nsBaseAppShell.cpp:158:27
    #24 0x7f8f138ef127 in XRE_RunAppShell() /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:866:22
    #25 0x7f8f09e8057b in RunInternal /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:326:10
    #26 0x7f8f09e8057b in RunHandler /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:319
    #27 0x7f8f09e8057b in MessageLoop::Run() /builds/worker/workspace/build/src/ipc/chromium/src/base/message_loop.cc:299
    #28 0x7f8f138eeb90 in XRE_InitChildProcess(int, char**, XREChildData const*) /builds/worker/workspace/build/src/toolkit/xre/nsEmbedFunctions.cpp:691:34
    #29 0x4eb843 in content_process_main /builds/worker/workspace/build/src/browser/app/../../ipc/contentproc/plugin-container.cpp:63:30
    #30 0x4eb843 in main /builds/worker/workspace/build/src/browser/app/nsBrowserApp.cpp:285
    #31 0x7f8f26c134c9 in __libc_start_main (/usr/lib/libc.so.6+0x204c9)
    #32 0x41d198 in _start (/home/truber/builds/m-c-1504147975-asan-opt/firefox+0x41d198)
Flags: in-testsuite?
Assignee: nobody → bzbarsky
Flags: needinfo?(bzbarsky)
Priority: -- → P2
Heh, fieldset + display: contents + first-line, what could go wrong...
Attached file More minimal testcase
Fieldset not really needed.  What's needed are three things:

1) A ::first-line style, so we land in this code.
2) A display:contents parent, so we end up hitting the "no providerFrame" bit.
3) An out-of-flow kid, so we get the wrong ancestor because we're not looking up from our placeholder.  That said, the _crash_ only happens for a fixed-pos ancestor, which has a parent quite wildly different from its placeholder's parent and wholly inappropriate for use for parent styles.
Flags: needinfo?(bzbarsky)
Comment on attachment 8903319 [details] [diff] [review]
When looking for our layout parent style, make sure to start with the placeholder if we're out of flow

Review of attachment 8903319 [details] [diff] [review]:
-----------------------------------------------------------------

Nice fix!

r=me
Attachment #8903319 - Flags: review?(emilio) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/82052535770f
When looking for our layout parent style, make sure to start with the placeholder if we're out of flow.  r=emilio
https://hg.mozilla.org/mozilla-central/rev/82052535770f
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.