Closed Bug 282453 Opened 20 years ago Closed 20 years ago

XFT crash when displaying page with bad font if character not found

Categories

(Core Graveyard :: GFX: Gtk, defect)

x86
Linux
defect
Not set
critical

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: lorenzo, Assigned: lorenzo)

Details

(Keywords: crash, fixed-aviary1.0.1, fixed1.7.6)

Attachments

(2 files)

Recently I've been crashing a lot on some web pages containing glyphs that are not found in my fonts. I most recently did this by searching for "acpi assembly language" on google. Talkback ID TB3721222H, http://talkback-public.mozilla.org/talkback/fastfind.jsp?search=2&type=iid&id=TB3721222H The problem seems to be here: http://lxr.mozilla.org/seamonkey/source/gfx/src/gtk/nsFontMetricsXft.cpp#948 948 for (PRInt32 end = mLoadedFonts.Count(); i < end; ++i) { 949 nsFontXft *font = (nsFontXft *)mLoadedFonts.ElementAt(i); 950 if (font->HasChar(aChar)) { 951 if (font->GetXftFont()) 952 return font; 953 // This is a bad font, so remove it from mLoadedFonts. This 954 // could happen if it's in fc.cache-1 but the font doesn't exist 955 // (https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=111973) 956 // or isn't readable. 957 mLoadedFonts.RemoveElementAt(i--); 958 } 959 } The loop keeps iterating until i == end, which is the size of the array at the beginning of the loop. However, if RemoveElementAt() has been called, if i == end it means that the loop has already gone past the end of the array. Result: an assertion in nsVoidArray, followed by a crash.
Attached file Testcase
Testcase, crashes every time for me.
CCing dbaron, who is in CVS blame for those lines
This fixes the problem, although I'm not sure about the elegance of a for statement with an empty first clause...
Attachment #174469 - Flags: superreview?(dbaron)
Attachment #174469 - Flags: review?(dbaron)
Comment on attachment 174469 [details] [diff] [review] proof-of-concept patch Nothing wrong with an empty first clause. r+sr=bzbarsky. I think it's worth taking this crash fix for 1.8b1
Attachment #174469 - Flags: superreview?(dbaron)
Attachment #174469 - Flags: superreview+
Attachment #174469 - Flags: review?(dbaron)
Attachment #174469 - Flags: review+
Attachment #174469 - Flags: approval1.8b?
Comment on attachment 174469 [details] [diff] [review] proof-of-concept patch r+sr=dbaron as well. This should go in on the branches where bug 180309 went in. This is a simple crash fix for the case where all the fonts are invalid.
Attachment #174469 - Flags: approval1.7.6?
Attachment #174469 - Flags: approval-aviary1.0.1?
Comment on attachment 174469 [details] [diff] [review] proof-of-concept patch a=mkaply for all
Attachment #174469 - Flags: approval1.8b?
Attachment #174469 - Flags: approval1.8b+
Attachment #174469 - Flags: approval1.7.6?
Attachment #174469 - Flags: approval1.7.6+
Attachment #174469 - Flags: approval-aviary1.0.1?
Attachment #174469 - Flags: approval-aviary1.0.1+
Fix checked in to trunk, 2005-02-16 09:07 -0800. Fix checked in to MOZILLA_1_7_BRANCH, 2005-02-16 09:08 -0800. Fix checked in to AVIARY_1_0_1_20050124_BRANCH, 2005-02-16 09:09 -0800. Thanks for the patch.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
using 2005022307-1.0.1 firefox bits (gtk2 installer build, on linux fc3), the attached test case doesn't crash for me. Lorenzo, does this work for using a recent nightly build? (trunk or branch, firefox or mozilla)
(In reply to comment #8) > using 2005022307-1.0.1 firefox bits (gtk2 installer build, on linux fc3), the > attached test case doesn't crash for me. I think it depends on the fonts you have installed. The bug is only triggered if you have a "bad font". > Lorenzo, does this work for using a recent nightly build? (trunk or branch, > firefox or mozilla) Yes, since dbaron's checkin this works perfectly. Marking verified.
Status: RESOLVED → VERIFIED
In case you need more info, I'm using a recent FF trunk build: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0
Sorry, that was FF 1.0. The one I'm using is this: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b2) Gecko/20050222 Firefox/1.0+
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: