sk_abort: SkTypes.h: fatal error: ""SkTFitsIn<D>(s)"" in SkScalerContext_Mac::generateMetrics

RESOLVED FIXED in Firefox 56

Status

()

Core
Graphics
P3
normal
RESOLVED FIXED
2 years ago
11 months ago

People

(Reporter: truber, Assigned: lsalzman)

Tracking

(Blocks: 2 bugs, {assertion, testcase})

Trunk
mozilla56
x86_64
Mac OS X
assertion, testcase
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox52 wontfix, firefox-esr52 wontfix, firefox54 wontfix, firefox55 wontfix, firefox56 fixed)

Details

(Whiteboard: [gfx-noted])

Attachments

(3 attachments)

(Reporter)

Description

2 years ago
Created attachment 8794251 [details]
testcase.html

Attached testcase triggers a skia abort in mozilla-central revision 60cc643978c7 (debug).

Assertion:

/builds/slave/m-cen-m64-d-000000000000000000/build/src/gfx/skia/skia/include/core/SkTypes.h:274: fatal error: ""SkTFitsIn<D>(s)""
Abort from sk_abort
Hit MOZ_CRASH() at /builds/slave/m-cen-m64-d-000000000000000000/build/src/memory/mozalloc/mozalloc_abort.cpp:33

Stacktrace:

    #0 0x60cc643978c7 in mozalloc_abort(char const*) memory/mozalloc/mozalloc_abort.cpp:33
    #1 0x60cc643978c7 in sk_abort_no_print() gfx/skia/skia/src/ports/SkMemory_mozalloc.cpp:16
    #2 0x60cc643978c7 in SkScalerContext_Mac::generateMetrics(SkGlyph*) gfx/skia/skia/include/core/SkTypes.h:274
    #3 0x60cc643978c7 in SkScalerContext::getMetrics(SkGlyph*) gfx/skia/skia/src/core/SkScalerContext.cpp:128
    #4 0x60cc643978c7 in SkGlyphCache::allocateNewGlyph(unsigned int, SkGlyphCache::MetricsType) gfx/skia/skia/src/core/SkGlyphCache.cpp:191
    #5 0x60cc643978c7 in SkGlyphCache::getGlyphIDMetrics(unsigned short, int, int) gfx/skia/skia/src/core/SkGlyphCache.cpp:168
    #6 0x60cc643978c7 in SkFindAndPlaceGlyph::GlyphIdGlyphFinder::lookupGlyphXY(char const**, int, int) gfx/skia/skia/src/core/SkFindAndPlaceGlyph.h:190
    #7 0x60cc643978c7 in SkFindAndPlaceGlyph::GlyphFindAndPlaceSubpixel<GrTextUtils::DrawBmpPosText(GrAtlasTextBlob*, int, GrBatchFontCache*, SkSurfaceProps const&, SkPaint const&, unsigned int, SkPaint::FakeGamma, SkMatrix const&, char const*, unsigned long, float const*, int, SkPoint const&)::$_1, (SkPaint::Align)0, (SkAxisAlignment)0>::findAndPositionGlyph(char const**, SkPoint, (GrTextUtils::DrawBmpPosText&&)(GrAtlasTextBlob*, int, GrBatchFontCache*, SkSurfaceProps const&, SkPaint const&, unsigned int, SkPaint::FakeGamma, SkMatrix const&, char const*, unsigned long, float const*, int, SkPoint const&)::$_1) gfx/skia/skia/src/core/SkFindAndPlaceGlyph.h:461
    #8 0x60cc643978c7 in GrTextUtils::DrawBmpPosText(GrAtlasTextBlob*, int, GrBatchFontCache*, SkSurfaceProps const&, SkPaint const&, unsigned int, SkPaint::FakeGamma, SkMatrix const&, char const*, unsigned long, float const*, int, SkPoint const&) gfx/skia/skia/src/core/SkFindAndPlaceGlyph.h:685
    #9 0x60cc643978c7 in GrAtlasTextContext::CreateDrawPosTextBlob(GrTextBlobCache*, GrBatchFontCache*, GrShaderCaps const&, GrPaint const&, SkPaint const&, SkPaint::FakeGamma, SkMatrix const&, SkSurfaceProps const&, char const*, unsigned long, float const*, int, SkPoint const&) gfx/skia/skia/src/gpu/text/GrAtlasTextContext.cpp:310
    #10 0x60cc643978c7 in GrAtlasTextContext::drawPosText(GrContext*, GrDrawContext*, GrClip const&, GrPaint const&, SkPaint const&, SkMatrix const&, SkSurfaceProps const&, char const*, unsigned long, float const*, int, SkPoint const&, SkIRect const&) gfx/skia/skia/src/gpu/text/GrAtlasTextContext.cpp:358
(Reporter)

Comment 1

2 years ago
Created attachment 8794252 [details]
log.txt
(Assignee)

Comment 2

2 years ago
his one looks Mac-only, so can only repro there. Mason, can you take a look?
Flags: needinfo?(mchang)
Priority: -- → P3
Whiteboard: [gfx-noted]
Assignee: nobody → mchang
Flags: needinfo?(mchang)
Mass wontfix for bugs affecting firefox 52.
status-firefox52: affected → wontfix
This still pop's up.
(Assignee)

Comment 5

a year ago
Created attachment 8877707 [details] [diff] [review]
don't let SkScalerContext::computeMatrices generate zero scales

SkScalerContext_Mac uses SkScalerContext::computeMatrices to factor out the rotation from the transform. This particular transform, while valid, once the rotation is factored out, has a 0 for it's Y scale. When this is later inverted to produce the output matrices, it fills the matrix with infs and nans. This causes problems downwind.

The Windows font hosts already check if the Y scale is 0, and if so, just set it to 1, so is otherwise immune to this. So it makes sense to just fix this centrally at the source of the problem, and never generate 0 for the scale in the first place. This way, all font hosts can proceed happily.
Assignee: mchang → lsalzman
Status: NEW → ASSIGNED
Attachment #8877707 - Flags: review?(mchang)
Attachment #8877707 - Flags: review?(mchang) → review+

Comment 7

11 months ago
Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a0a703ef8e42
don't let SkScalerContext::computeMatrices generate zero scales. r=mchang
https://hg.mozilla.org/mozilla-central/rev/a0a703ef8e42
Status: ASSIGNED → RESOLVED
Last Resolved: 11 months ago
status-firefox56: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Is there any reason to consider this for backport to 55 or can it ride the trains?
status-firefox54: --- → wontfix
status-firefox55: --- → affected
status-firefox-esr52: --- → wontfix
Flags: needinfo?(lsalzman)
(Assignee)

Comment 10

11 months ago
(In reply to Ryan VanderMeulen [:RyanVM] from comment #9)
> Is there any reason to consider this for backport to 55 or can it ride the
> trains?

The only real consequence of this should be the assertion in debug mode, which this fixes. But otherwise, in release builds, text will just fail to show up regardless. So I think this is safe to just let ride the trains.
Flags: needinfo?(lsalzman)
status-firefox55: affected → wontfix
You need to log in before you can comment on or make changes to this bug.