bugThe FreeType Project - Bugs: bug #37669, SIGSEGV on Android phones

 
 

bug #37669: SIGSEGV on Android phones

Submitted by:  None
Submitted on:  Mon 05 Nov 2012 04:53:42 PM UTC  
 
Severity: 3 - NormalItem Group: Crash
Status: InvalidPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 06 Nov 2012 11:09:12 PM UTC, comment #3:

Good that you've resolved this issue!

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Tue 06 Nov 2012 03:48:18 PM UTC, comment #2:

Hi Werner,

Thank you for your suggestion! Freetype's memory debugger and Valgrind were the way to go. The font memory was prematurely deallocated before FT_Done_Face was called.

"You must not deallocate the memory before calling FT_Done_Face."

Missed that line in the docs. Pity it wasn't marked in bold red for me ;)

Cheers,
Marek

Marek <marek_dabek>
Mon 05 Nov 2012 05:42:46 PM UTC, comment #1:

I fear I can't help. What you experience sounds like memory corruption -- FreeType doesn' modify the memory area of a loaded font, IIRC. No problems with the cmap code or the PEEK macros and functions are known.

I'm quite sure this is not a problem of FreeType. What about running valgrind or something similar? Or maybe you can activate FreeType's memory debugger? Have a look into docs/DEBUG in the source bundle.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 05 Nov 2012 04:53:42 PM UTC, original submission:

Hi,

I'm trying to cross compile FreeType 2.4.10 and run it with Cairo 1.10.2 on Android as static libraries. I set up a program that loads a ttf font from file to memory, calls "FT_New_Memory_Face" and passes the FT_Face to "cairo_ft_font_face_create_for_ft_face". The SIGSEGV happens after any text rendering call in Cairo (i.e. "cairo_show_text"). Cairo works fine if I don't pass any FT fonts (use default font).

At first it looked like "tt_cmap4_char_map_binary" was to blame. I disabled "cmap4" functions in "ftoptions.h" and it started to crash in other places (interpreter, get_glyph...). I finally noticed that the crashes always happened on TT_PEEK_USHORT or FT_PEEK_USHORT. I tried running it on other phones (HTC Explorer with Android 2.3, HTC HD2 with Android 2.3 and Nexus with Android 4.0). Funny thing is it worked only on HTC Explorer, other SIGSEGVed exactly the same way.

I've been trying to debug the issue for few days now, no success so far. Here are the details:

Host:
Ubuntu Release 12.04 (precise) 32-bit
Kernel Linux 3.2.0-32-generic-pae
Processor: AMD E-450 APU with Radeon(tm) HD Graphics × 2

Target:
Galaxu Nexus running Android 4.1.2

Toolchain:
CMake and CMake for Android
NDK version r8b, standalone toolchain (using GCC 4.6)

./configure ran with options:
--enable-static=yes --enable-shared=yes --prefix=$AND_SYSROOT/usr

Tried to compile with and without these flags:
-mandroid
-mfloat-abi=soft OR -mfloat-abi=softfp
-msoft-float
-mfpu=neon
-march=armv5 OR -march=armv7-a
-Wl,--fix-cortex-a8
-fno-strict-aliasing
-g
-O0
-ggdb
-fPIC
-DPIC

Stacktrace:
#0 0x5d405ebc in tt_cmap4_char_map_binary (cmap=0x59e29f40, pcharcode=0x5d7a0440, next=0 '\000') at /home/user/Desktop/Projects/freetype-2.4.10/src/sfnt/ttcmap.c:1097
#1 0x5d406a04 in tt_cmap4_char_index (cmap=0x59e29f40, char_code=83) at /home/user/Desktop/Projects/freetype-2.4.10/src/sfnt/ttcmap.c:1329
#2 0x5d3b5700 in FT_Get_Char_Index (face=0x5c52e610, charcode=83) at /home/user/Desktop/Projects/freetype-2.4.10/src/base/ftobjs.c:3306
#3 0x5d395ce8 in _cairo_ft_ucs4_to_index (abstract_font=0x5c7b8c08, ucs4=83) at cairo-ft-font.c:2354
#4 0x5d376098 in cairo_scaled_font_text_to_glyphs_internal_uncached (scaled_font=0x5c7b8c08, x=200, y=400, utf8=0x5c7b8b34 "Siemka!", glyphs=0x5d7a0da0, clusters=0x0, num_chars=7) at cairo-scaled-font.c:1681
#5 0x5d3766dc in INT_cairo_scaled_font_text_to_glyphs (scaled_font=0x5c7b8c08, x=200, y=400, utf8=0x5c7b8b34 "Siemka!", utf8_len=7, glyphs=0x5d7a15bc, num_glyphs=0x5d7a15b4, clusters=0x0, num_clusters=0x0,
cluster_flags=0x0) at cairo-scaled-font.c:2007
#6 0x5d3456d0 in _cairo_gstate_text_to_glyphs (gstate=0x5d699130, x=200, y=400, utf8=0x5c7b8b34 "Siemka!", utf8_len=7, glyphs=0x5d7a15bc, num_glyphs=0x5d7a15b4, clusters=0x0, num_clusters=0x5d7a15b0,
cluster_flags=0x5d7a15ac) at cairo-gstate.c:1848
#7 0x5d33ab44 in cairo_show_text (cr=0x5d699110, utf8=0x5c7b8b34 "Siemka!") at cairo.c:3437

Cheers,
Marek

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by marek_dabek (Posted a comment)
  • -unavailable- added by wl (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 06 Nov 2012 11:09:12 PM UTCwlStatusNeed Info=>Invalid
      Open/ClosedOpen=>Closed
    Mon 05 Nov 2012 05:42:46 PM UTCwlStatusNone=>Need Info
      Assigned toNone=>wl

    Back to the top


    Powered by Savane 3.1-cleanup1