Bug 155109 - Crash in WebCore::RenderElement::containingBlockForObjectInFlow
Summary: Crash in WebCore::RenderElement::containingBlockForObjectInFlow
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-03-07 05:39 PST by Michael Catanzaro
Modified: 2016-03-25 11:23 PDT (History)
12 users (show)

See Also:


Attachments
Backtrace (457.01 KB, text/plain)
2016-03-07 05:39 PST, Michael Catanzaro
no flags Details
Patch (20.18 KB, patch)
2016-03-07 15:07 PST, zalan
no flags Details | Formatted Diff | Diff
Patch (20.17 KB, patch)
2016-03-07 15:18 PST, zalan
no flags Details | Formatted Diff | Diff
Backtrace with WebKitGTK+ 2.12.0 (90.34 KB, application/octet-stream)
2016-03-25 07:09 PDT, Michael Catanzaro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2016-03-07 05:39:02 PST
Created attachment 273175 [details]
Backtrace

I can't reproduce this, but a user testing WebKitGTK+ 2.11.91 reports that WebKit crashes whenever he visits www.seznam.cz in WebCore::RenderElement::containingBlockForObjectInFlow. Backtrace attached.
Comment 1 zalan 2016-03-07 15:07:46 PST
Created attachment 273221 [details]
Patch
Comment 2 zalan 2016-03-07 15:08:39 PST
I wasn't able to rerpo this, but it's certainly unsafe to call containingBlock() unconditionally in that loop.
Comment 3 Simon Fraser (smfr) 2016-03-07 15:12:20 PST
Comment on attachment 273221 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=273221&action=review

> Source/WebCore/rendering/RenderBlock.cpp:259
> +            while (containingBlock && (containingBlock->style().position() == StaticPosition || (containingBlock->isInline() && !containingBlock->isReplaced()))
> +                && !is<RenderView>(*containingBlock)) {

I would put the RenderView check at the beginning:

while (containingBlock && !is<RenderView>(*containingBlock)...

> Source/WebCore/rendering/RenderBoxModelObject.cpp:243
> +    while (cb && cb->isAnonymous() && !is<RenderView>(*cb))

!is<RenderView>(*cb) second.

> Source/WebCore/rendering/RenderFlowThread.cpp:446
> +        while (objContainingBlock && !objContainingBlock->isRenderNamedFlowThread() && !is<RenderView>(*objContainingBlock)) {

while (objContainingBlock && !is<RenderView>(*objContainingBlock)

> Source/WebCore/rendering/RenderFlowThread.cpp:1228
> +    while (currentBlock && !currentBlock->isRenderFlowThread() && !is<RenderView>(*currentBlock)) {

Same
Comment 4 zalan 2016-03-07 15:18:32 PST
Created attachment 273224 [details]
Patch
Comment 5 WebKit Commit Bot 2016-03-07 16:45:15 PST
Comment on attachment 273224 [details]
Patch

Clearing flags on attachment: 273224

Committed r197716: <http://trac.webkit.org/changeset/197716>
Comment 6 WebKit Commit Bot 2016-03-07 16:45:19 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Michael Catanzaro 2016-03-25 07:09:31 PDT
Created attachment 274905 [details]
Backtrace with WebKitGTK+ 2.12.0

Unfortunately this patch didn't fix it; I have so far eight reports of this crash with WebKitGTK+ 2.11.92 (which includes the patch in this bug) and 12 with 2.12.0. Here's a backtrace taken with 2.12.0.

FWIW, it seems likely that the crash was introduced in 2.11.90 as I couldn't find any prior reports of this, so it's probably due to some recent change.
Comment 8 Michael Catanzaro 2016-03-25 07:18:53 PDT
Oh and a reported reproducer:

"I've tried to add an online account, selecting Facebook as provider.
If I switch to caps lock while typing the password, the dialog crashes.

Of course, this happens to other web services, like Google and Microsoft."

I couldn't reproduce this issue in my jhbuild environment. The web view in this case is displaying https://www.facebook.com/login
Comment 9 zalan 2016-03-25 08:39:20 PDT
(In reply to comment #7)
> Created attachment 274905 [details]
> Backtrace with WebKitGTK+ 2.12.0
> 
> Unfortunately this patch didn't fix it; I have so far eight reports of this
> crash with WebKitGTK+ 2.11.92 (which includes the patch in this bug) and 12
> with 2.12.0. Here's a backtrace taken with 2.12.0.
> 
> FWIW, it seems likely that the crash was introduced in 2.11.90 as I couldn't
> find any prior reports of this, so it's probably due to some recent change.

The attached backtrace shows a different issue. I'll file a new bugzilla for it.
Comment 10 Michael Catanzaro 2016-03-25 09:00:31 PDT
OK, thanks.
Comment 11 Radar WebKit Bug Importer 2016-03-25 11:23:04 PDT
<rdar://problem/25362489>