Closed Bug 331077 Opened 20 years ago Closed 20 years ago

nsFontMetricsXft::CacheFontMetrics() : face may be NULL [@ nsFontMetricsXft::CacheFontMetrics]

Categories

(Core Graveyard :: GFX: Gtk, defect)

x86
Linux
defect
Not set
critical

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: tobiasu, Assigned: dbaron)

References

Details

(4 keywords, Whiteboard: (fixed by 183729))

Crash Data

User-Agent: Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.8.0.1) Gecko/20060318 Firefox/1.5.0.1 Build Identifier: Mozilla/5.0 (X11; U; OpenBSD i386; en-US; rv:1.8.0.1) Gecko/20060318 Firefox/1.5.0.1 Under some circumstances, XftLockFace() can return NULL (See XftLockFace sourcecode...). This results in a nullpointer dereference and obviously in a crash. There was a bug report about this here: https://bugzilla.mozilla.org/show_bug.cgi?id=183729, but it was closed as a duplicate of this bug: https://bugzilla.mozilla.org/show_bug.cgi?id=180309. Since this bug description is not really appropriate (It's not cause by unreadable fonts), I open a new bugreport. Two patches are available: http://arkiv.netbsd.se/?ml=openbsd-ports&a=2006-03&m=1852803 or https://bugzilla.mozilla.org/attachment.cgi?id=140288 This bug also applies to the Mozilla Suite. Reproducible: Sometimes Steps to Reproduce: Browse on zdnet or ebay... (May have something to do with the minimum fontsize and changed default fonts, however my setup is to complex to reproduce this and it's a complete waste of time. XftLockFace() is specified to return NULL and the code should act uppon it, so just fix it) Actual Results: Crash. (Segfault) Expected Results: Not to crash ;) --with-system-jpeg=/usr/local --with-system-png=/usr/local --with-system-zlib=/usr/lib --with-pthreads --without-system-nspr --enable-xft --enable-optimize=-Os --enable-default-toolkit=gtk2 --disable-debug --disable-tests --disable-pedantic --disable-installer --disable-updater --disable-gnomeui --disable-gnomevfs --enable-xinerama --enable-svg --enable-svg-renderer=cairo --enable-system-cairo --enable-canvas --enable-application=browser --prefix=/usr/local --sysconfdir=/etc
Component: General → Layout: Fonts and Text
Product: Firefox → Core
QA Contact: general → layout.fonts-and-text
Version: unspecified → Trunk
There's a patch that will allegedly fix this on bug 183729.
*** This bug has been marked as a duplicate of 183729 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Marking this duplicate was a bad idea, that other bug was originally something else, but just happened to have a patch that would fix this one. This is a topcrash for Linux Firefox 1.5.0.2. There's a patch on the bug 183729 for it.
Status: RESOLVED → UNCONFIRMED
Flags: blocking1.8.0.3?
Keywords: crash, topcrash
OS: OpenBSD → Linux
Resolution: DUPLICATE → ---
Summary: nsFontMetricsXft::CacheFontMetrics() : face may be NULL → nsFontMetricsXft::CacheFontMetrics() : face may be NULL [@ nsFontMetricsXft::CacheFontMetrics]
Assignee: nobody → dbaron
Status: UNCONFIRMED → NEW
Component: Layout: Fonts and Text → GFX: Gtk
Ever confirmed: true
Patch there checked in to trunk and MOZILLA_1_8_BRANCH. I think we need to make sure that failure returns from this function don't crash elsewhere, though. I'm not confident that that's the case...
Keywords: fixed1.8
Status: NEW → RESOLVED
Closed: 20 years ago20 years ago
Resolution: --- → FIXED
Yeah, I'm thinking that what we really need to do is make checking that XftLockFace succeeds be part of GetXftFont so that FindFont doesn't return a font for which it fails.
Thing is, we call XftLockFace only on mWesternFont, not on all of them, so I wouldn't want to waste the time later. (Or if XftLockFace fails, would other uses of the font also fail?)
Status: RESOLVED → REOPENED
Keywords: fixed1.8
Resolution: FIXED → ---
What I don't understand is how XftLockFace could return null when XftFontOpenInfo has already returned non-null. That said, we should probably call XftUnlockFace at some point...
(In reply to comment #7) > That said, we should probably call XftUnlockFace at some point... Er, never mind, we already do.
Setting back to fixed -- based on looking at the Xft code, this is a situation that basically shouldn't happen unless we run out of memory, although that may not have been true for older versions of Xft. In any case, we *do* handle the error, as long as it's not the first font in the font cache, thanks to what nsFontCache::GetMetricsFor does when nsIFontMetrics::Init fails. But I suspect something was different for older versions of Xft, or I'm misreading something, since users are actually hitting it...
Status: REOPENED → RESOLVED
Closed: 20 years ago20 years ago
Keywords: fixed1.8
Resolution: --- → FIXED
Depends on: 183729
Whiteboard: (fixed by 183729)
Flags: blocking1.8.0.3? → blocking1.8.0.3+
no longer seeing on topcrash reports
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
Crash Signature: [@ nsFontMetricsXft::CacheFontMetrics]
You need to log in before you can comment on or make changes to this bug.