fontforge / fontforge

Free (libre) font editor for Windows, Mac OS X and GNU+Linux
http://fontforge.github.io/
Other
6.37k stars 696 forks source link

Load SkiaRegular.ttf (version 4.0) makes FontForge crash. #2129

Open lemzwerg opened 9 years ago

lemzwerg commented 9 years ago

[Based on sources from 22:50 CET 8-Mar-2015-ML-TtfDb-D. Based on source from git with hash: e27e285fb052cc52ca5548103494ace48563aecd]

Calling fontforge SkiaRegular.ttf causes the following assertion failure.

fontforge: malloc.c:2369: sysmalloc:
Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) -
__builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) ||
((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (
struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) &
~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) &&
((unsigned long) old_end & pagemask) == 0)' failed.

This is a regression. FontForge version 31-Jul-2012 loads the font.

adrientetar commented 9 years ago

I don't have access to this font. Can you post a backtrace?

lemzwerg commented 9 years ago

I can't, since I currently don't have a debug build. However, give me an e-mail address, and I will send you the font privately.

lemzwerg commented 9 years ago

OK, sent.

lemzwerg commented 9 years ago

Oops! I get

SMTP error from remote server after RCPT command:
host: mx2.hotmail.com
Requested action not taken: mailbox unavailable

Do you have another e-mail address?

lemzwerg commented 9 years ago

OK, resent.

adrientetar commented 9 years ago

There are some warnings but it does not crash for me.

skia

lemzwerg commented 9 years ago

Hmm. I'm compiling with

./bootstrap
./configure --enable-debug-raw-points \
            --enable-silent-rules \
            --enable-freetype-debugger=/path/to/freetype \
            CFLAGS="-g -O0"

on a 32bit GNU/Linux box using gcc 4.8.3. Maybe a 32bit vs. 64bit issue...

frank-trampe commented 9 years ago

@lemzwerg, send me the file.

lemzwerg commented 9 years ago

Will do. What e-mail address shall I use?

frank-trampe commented 9 years ago

I just sent you an e-mail.

lemzwerg commented 9 years ago

Thanks. Font sent.

frank-trampe commented 9 years ago

@lemzwerg, I figured out what is happening, but I'm not sure how best to deal with it.

InfoCopyGlyphs makes the glyphs for the variations, but it only allocates according the original/actual glyph count. _readttfmort then increases the glyph count and adds space in the main glyph storage info->chars (but not in the variation glyph storage) for fake glyphs. This causes problems when dealing with the variations, because the main glyph count is the only measure of how many spaces are allocated there and may be larger than the actual number of spaces allocated, causing a crash in SFFromTuple.

There are a few possible options.

I lack sufficient knowledge of TrueType to determine which of these is best. Any thoughts?

lemzwerg commented 9 years ago

Unfortunately, my knowledge of GX fonts is still quite limited (and I have zero knowledge regarding GX font editing). @twardoch, can you make a suggestion here?