Open Bug 1625252 Opened 4 years ago Updated 1 year ago

[first-letter][bidi] SEGV in GetWritingMode from nsLineLayout::NewPerFrameData()

Categories

(Core :: Layout: Block and Inline, defect, P3)

defect

Tracking

()

Tracking Status
firefox-esr78 --- wontfix
firefox-esr91 --- wontfix
firefox-esr102 --- affected
firefox91 --- wontfix
firefox92 --- wontfix
firefox93 --- wontfix
firefox108 --- wontfix
firefox109 --- affected
firefox110 --- affected

People

(Reporter: tarafans7, Unassigned)

References

(Blocks 2 open bugs)

Details

(4 keywords, Whiteboard: [bugmon:bisected,confirmed])

Crash Data

Attachments

(4 files)

Attached file poc2.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36

Steps to reproduce:

A crash is found by fuzzing Nightly build.
I used ffpuppet with the official ASAN nightly build on Mar 25.
PoC and ASAN log are attached.
From some study, I suspect this is a regression.

Attached file ASAN log
Group: firefox-core-security → layout-core-security
Component: Untriaged → Layout: Block and Inline
Product: Firefox → Core

HI reporter, do you have a regression range? I tried with mozregression but asan-debug builds there don't go back that far. I checked a 2019-07-01 build and could still reproduce.

This is a null pointer dereference so I'm not sure it needs to be a sec bug.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(tarafans7)

Hi,

Sorry, I am not clear in fact.
I said that simply because I saw this: https://bugzilla.mozilla.org/show_bug.cgi?id=1493775
But that is a too old one...that's why I still report as a new bug here.

Thanks.

Flags: needinfo?(tarafans7)
Attached file Reduced testcase

Both the original test and this reduced testcase crashes ~50% of the time on load (on Linux). After reloading a few times it always crashes though, so it can probably be made more reliable.

The empty nsFirstLetterFrame comes from nsBidiPresUtils::ResolveParagraph. As you can see in the frame dump above, it's a bidi-continuation. I can think of a few ways to fix this:

  1. when creating nsFirstLetterFrame bidi-continuations, always insert a text frame continuation too if it's missing
  2. make nsFirstLetterFrame::Reflow deal with having no children
  3. handle nsFirstLetterFrame as non-splittable in nsBidiPresUtils somehow

(I think 3 might lead to wrong bidi layout in some cases though, so it's probably not a good long term solution.)

Summary: SEGV in GetWritingMode from nsLineLayout::NewPerFrameData() → [first-letter][bidi] SEGV in GetWritingMode from nsLineLayout::NewPerFrameData()

Making the bug public since I'm pretty sure this always results in a safe null-pointer crash at worst.
Setting the priority to P3 since it seems unlikely this will affect many real web sites.

Group: layout-core-security
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All

BTW, this is very likely the same underlying issue as bug 1493775, although I can't reproduce that bug so I can't say for sure. I'm marking that bug depend on this for now, since this is reproducible.

Blocks: 1493775

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression

Because this bug's Severity has not been changed from the default since it was filed, and it's Priority is P3 (Backlog,) indicating it has been triaged, the bug's Severity is being updated to S3 (normal.)

Severity: normal → S3
Blocks: grizzly
Crash Signature: [@ nsLineLayout::ReflowFrame ]
Flags: in-testsuite?
Keywords: bugmon, crash, testcase

Bugmon Analysis
Verified bug as reproducible on mozilla-central 20210810094908-efefbf74d3fc.
Failed to bisect testcase (Testcase reproduces on start build!):

Start: 5d63045bb341739c7eff24fc3bac085ab873c4b5 (20200811214738)
End: 5d63045bb341739c7eff24fc3bac085ab873c4b5 (20200811214738)
BuildFlags: BuildFlags(asan=False, tsan=False, debug=False, fuzzing=False, coverage=False, valgrind=False, no_opt=False, fuzzilli=False)

Whiteboard: [bugmon:bisected,confirmed]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: