Bug 2902

Summary: segmentation fault in fc-cache 2.3.1 on ppc linux
Product: fontconfig Reporter: Arkadiusz Miskiewicz <arekm>
Component: fc-cacheAssignee: Keith Packard <keithp>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: julien
Version: 2.3   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Arkadiusz Miskiewicz 2005-04-04 10:43:07 UTC
The problems is that on my PPC I'm getting:
(gdb) where
#0  0x00000000 in ?? ()
#1  0x0ffb9b80 in GetScriptTags (face=0x30066d10, tabletag=1196445523, stags=0x7fffee9c, 
script_count=0x7fffeea2)
    at fcfreetype.c:2707
#2  0x0ffb9f84 in FcFontCapabilities (face=0x30066d10) at fcfreetype.c:2795
#3  0x0ffb75a4 in FcFreeTypeQuery (file=0x303c8fe4 "/home/users/arekm/test/TTF/luxisr.ttf", 
id=0, blanks=0x3040aff4,
    count=0x7ffff028) at fcfreetype.c:1378
#4  0x0ffb52d0 in FcFileScanConfig (set=0x30186ff4, dirs=0x301c2ff0, cache=0x0, 
blanks=0x3040aff4,
    file=0x303c8fe4 "/home/users/arekm/test/TTF/luxisr.ttf", force=1, config=0x0) at fcdir.c:117
#5  0x0ffb5870 in FcDirScanConfig (set=0x30186ff4, dirs=0x301c2ff0, cache=0x0, 
blanks=0x3040aff4,
    dir=0x30091fe4 "/home/users/arekm/test/TTF", force=1, config=0x0) at fcdir.c:275
#6  0x0ffb592c in FcDirScan (set=0x30186ff4, dirs=0x301c2ff0, cache=0x0, blanks=0x3040aff4,
    dir=0x30091fe4 "/home/users/arekm/test/TTF", force=1) at fcdir.c:298
#7  0x10001f14 in scanDirs (list=0x3009bff8, config=0x3003cfc0,
    program=0x7ffff3d2 "/home/users/arekm/rpm/BUILD/fontconfig-2.3.1/fc-cache/.libs/fc-cache", 
force=1, verbose=0)
    at fc-cache.c:179
#8  0x10002378 in main (argc=3, argv=0x7ffff254) at fc-cache.c:291
(gdb) frame 1
#1  0x0ffb9b80 in GetScriptTags (face=0x30066d10, tabletag=1196445523, stags=0x7fffee9c, 
script_count=0x7fffeea2)
    at fcfreetype.c:2707
2707        if (( error = tt_face->goto_table( tt_face, tabletag, stream, 0 ) ))
(gdb) l
2702        FT_Memory  memory = stream->memory;
2703
2704        if ( !stream )
2705            return TT_Err_Invalid_Face_Handle;
2706
2707        if (( error = tt_face->goto_table( tt_face, tabletag, stream, 0 ) ))
2708            return error;
2709
2710        base_offset = FT_STREAM_POS();
2711
(gdb) print tt_face
$5 = 0x30066d10
(gdb) print tt_face->goto_table
$6 = 0


I've tried to reproduce the same thing on athlon machine with no luck. I'm using freetype 2.1.9.

Adding ugly hack:
[arekm@iarm ~/rpm/BUILD/fontconfig-2.3.1]$ diff -u src/fcfreetype.c\~ src/fcfreetype.c
--- src/fcfreetype.c~   2005-04-04 18:59:54.000000000 +0200
+++ src/fcfreetype.c    2005-04-04 19:29:22.000000000 +0200
@@ -2701,7 +2701,7 @@
     FT_UShort          n, p;
     FT_Memory  memory = stream->memory;

-    if ( !stream )
+    if ( !stream || !tt_face->goto_table )
        return TT_Err_Invalid_Face_Handle;

     if (( error = tt_face->goto_table( tt_face, tabletag, stream, 0 ) ))

made it working somehow (didn't crash).

face passed to GetScriptTags was:
(gdb) print *face
$2 = {num_faces = 1, face_index = 0, face_flags = 569, style_flags = 0, num_glyphs = 391,
  family_name = 0x30072ff4 "Luxi Sans", style_name = 0x30076ff8 "Regular", num_fixed_sizes = 
0, available_sizes = 0x0,
  num_charmaps = 2, charmaps = 0x3040eff8, generic = {data = 0x0, finalizer = 0}, bbox = {xMin = 
-441, yMin = -432,
    xMax = 2024, yMax = 2033}, units_per_EM = 2048, ascender = 2033, descender = -432, height 
= 2465,
  max_advance_width = 2079, max_advance_height = 2465, underline_position = 0, 
underline_thickness = 0,
  glyph = 0x30412f60, size = 0x30418ec0, charmap = 0x3040cfc4, driver = 0x302a6fb4, memory = 
0x301fdff0,
  stream = 0x30064fd8, sizes_list = {head = 0x3041aff4, tail = 0x3041aff4}, autohint = {data = 0x0, 
finalizer = 0},
  extensions = 0x0, internal = 0x30068fcc}


ps. fontconfig bugzilla component lacks latest releases (you can't choose 2.3.1 as version)
Comment 1 Keith Packard 2005-04-04 11:04:13 UTC
I'm afraid your 'ugly hack' is probably the best answer for now -- I don't know
why FreeType on your machine doesn't support the true type 'goto_table' function
though, it certainly should.

This will have the effect of eliminating some information about layout
capabilities from the font database, which Pango (may) use to identify useful fonts.
Comment 2 Keith Packard 2005-04-04 11:04:44 UTC
Set version to 2.3
Comment 3 Patrick Lam 2006-03-11 14:53:51 UTC
By the way, fontconfig compiles fine on a PPC G4 under Mac OS X.
Comment 4 Patrick Lam 2006-04-08 01:17:17 UTC
*** Bug 3107 has been marked as a duplicate of this bug. ***
Comment 5 Patrick Lam 2006-04-08 03:51:25 UTC
We now use ftglue.c, which shouldn't be able to crash in this way, since it
doesn't use a function pointer...

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.