From: Aktado <ak...@us...> - 2011-08-11 07:21:20
|
Using MergeFonts() procedure in FontForge scripting language on Linux, I get a warning message that says: | The glyph named uniXXXX is mapped to U+YYYY. | But its name indicates it should be mapped to U+XXXX. (The values of XXXX and YYYY vary each run.) I think it occurs from double-free of sc->ttf_instrs. In fvfonts.c, SplineCharCopy() function copies sc to nsc shallowly. nsc->ttf_instrs can be free'd in SCConvertLayerToOrder3(), and then sc->ttf_instrs, which has the same address as nsc->ttf_instrs, is free'd in SplineCharFreeContent() again. P.S. I've heard 64-bit version of FontForge crashes with segfault on MacOS X, perhaps in MergeFonts(). I guess this patch also remedies the problem, but don't see for myself. diff --git a/fontforge/fvfonts.c b/fontforge/fvfonts.c --- a/fontforge/fvfonts.c +++ b/fontforge/fvfonts.c @@ -490,6 +490,7 @@ int layer, lycopy; *nsc = *sc; /* We copy the layers just below */ + nsc->ttf_instrs = NULL; nsc->ttf_instrs_len = 0; nsc->layer_cnt = into==NULL?2:into->layer_cnt; nsc->layers = layers; lycopy = sc->layer_cnt>nsc->layer_cnt ? nsc->layer_cnt : sc->layer_cnt; @@ -528,7 +529,8 @@ nsc->anchor = AnchorPointsDuplicate(nsc->anchor,nsc); nsc->changed = true; nsc->dependents = NULL; /* Fix up later when we know more */ - if ( nsc->ttf_instrs_len!=0 ) { + if ( sc->ttf_instrs_len!=0 ) { + nsc->ttf_instrs_len = sc->ttf_instrs_len; nsc->ttf_instrs = galloc(nsc->ttf_instrs_len); memcpy(nsc->ttf_instrs,sc->ttf_instrs,nsc->ttf_instrs_len); } |