Crash in makeotfGlyphs

Hi, i’m evaluating Glyphs and it’s crashing when trying to export an emoji font to OTF or WOFF2. It looks to be choking on glyphs which have been given names which are longer named (by Glyphs.app?) longer than 64 bytes.

$ lldb /Applications/Glyphs.app/Contents/PlugIns/OTF.glyphsFileFormat/Contents/Resources/makeotfGlyphs
(lldb) target create "/Applications/Glyphs.app/Contents/PlugIns/OTF.glyphsFileFormat/Contents/Resources/makeotfGlyphs"
Current executable set to '/Applications/Glyphs.app/Contents/PlugIns/OTF.glyphsFileFormat/Contents/Resources/makeotfGlyphs' (x86_64).
(lldb) run -f font.pfa -mf FontMenuNameDB -ff features.fea -overrideMenuNames -o font.otf -osbOn 6 -fs -ga -gf GlyphOrderAndAliasDB -r                                                                                      Process 35067 launched: '/Applications/Glyphs.app/Contents/PlugIns/OTF.glyphsFileFormat/Contents/Resources/makeotfGlyphs' (x86_64)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1672] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1673] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1674] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1675] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1676] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1678] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1679] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1680] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1681] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1682] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1854] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1855] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1856] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1857] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:1858] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:2114] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:2115] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:2116] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:2117] (record skipped)(gnameError)
makeotfGlyphs [WARNING] syntax error [GlyphOrderAndAliasDB:2118] (record skipped)(gnameError)
2019-06-01 23:05:13.554731+0100 makeotfGlyphs[35067:2013256] detected buffer overflow
Process 35067 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00007fff659532c6 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff659532c6 <+10>: jae    0x7fff659532d0            ; <+20>
    0x7fff659532c8 <+12>: movq   %rax, %rdi
    0x7fff659532cb <+15>: jmp    0x7fff6594d457            ; cerror_nocancel
    0x7fff659532d0 <+20>: retq   
Target 0: (makeotfGlyphs) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
  * frame #0: 0x00007fff659532c6 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff65a0ebf1 libsystem_pthread.dylib`pthread_kill + 284
    frame #2: 0x00007fff658bd6a6 libsystem_c.dylib`abort + 127
    frame #3: 0x00007fff658bd819 libsystem_c.dylib`abort_report_np + 177
    frame #4: 0x00007fff658e1cb1 libsystem_c.dylib`__chk_fail + 48
    frame #5: 0x00007fff658e1c81 libsystem_c.dylib`__chk_fail_overflow + 16
    frame #6: 0x00007fff658e1e2f libsystem_c.dylib`__strncpy_chk + 93
    frame #7: 0x0000000100054890 makeotfGlyphs`readChars + 609
    frame #8: 0x0000000100050d7d makeotfGlyphs`doLiteral + 578
    frame #9: 0x0000000100050a24 makeotfGlyphs`parseFont + 373
    frame #10: 0x00000001000425d5 makeotfGlyphs`tcCompactFont + 14
    frame #11: 0x0000000100010f11 makeotfGlyphs`hotReadFont + 239
    frame #12: 0x0000000100005015 makeotfGlyphs`psConvFont + 199
    frame #13: 0x0000000100004c29 makeotfGlyphs`cbConvert + 333
    frame #14: 0x00000001000023e5 makeotfGlyphs`convFont + 165
    frame #15: 0x0000000100001fdd makeotfGlyphs`parseArgs + 2855
    frame #16: 0x0000000100001431 makeotfGlyphs`main + 369
    frame #17: 0x00007fff658183d5 libdyld.dylib`start + 1
    frame #18: 0x00007fff658183d5 libdyld.dylib`start + 1
(lldb) frame select 7
frame #7: 0x0000000100054890 makeotfGlyphs`readChars + 609
makeotfGlyphs`readChars:
->  0x100054890 <+609>: movl   -0x88(%rbp), %eax
    0x100054896 <+615>: movb   $0x0, -0x70(%rbp,%rax)
    0x10005489b <+620>: movq   (%r14), %rdi
    0x10005489e <+623>: movq   %r15, %rsi
(lldb) register read 
General Purpose Registers:
       rbx = 0x00007ffeefbfe678
       rbp = 0x00007ffeefbfe720
       rsp = 0x00007ffeefbfe630
       r12 = 0x000000010080de00
       r13 = 0x0000000000000013
       r14 = 0x0000000100500000
       r15 = 0x00007ffeefbfe6b0
       rip = 0x0000000100054890  makeotfGlyphs`readChars + 609
13 registers were unavailable.

(lldb) memory read 0x00007ffeefbfe630
0x7ffeefbfe630: d0 57 06 00 01 00 00 00 90 fd 80 00 01 00 00 00  ?W.......?......
0x7ffeefbfe640: 70 ef 80 00 01 00 00 00 a0 05 81 00 01 00 00 00  p?......?.......
(lldb) 
0x7ffeefbfe650: ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00  ????????........
0x7ffeefbfe660: 01 00 00 00 00 00 00 00 88 43 01 00 00 00 00 00  .........C......
(lldb) 
0x7ffeefbfe670: 02 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00  ................
0x7ffeefbfe680: 43 43 01 00 00 00 00 00 44 00 00 00 00 00 00 00  CC......D.......
(lldb) 
0x7ffeefbfe690: b0 e6 bf ef 00 00 00 00 43 00 00 00 01 00 00 00  ???....C.......
0x7ffeefbfe6a0: 44 43 01 10 01 00 00 00 00 00 50 00 01 00 00 00  DC........P.....
(lldb) 
0x7ffeefbfe6b0: 72 61 69 73 65 64 48 61 6e 64 57 69 74 68 46 69  raisedHandWithFi
0x7ffeefbfe6c0: 6e 67 65 72 73 53 70 6c 61 79 65 64 00 65 6d 6f  ngersSplayed.emo
(lldb) 
0x7ffeefbfe6d0: 6a 69 4d 6f 64 69 66 69 65 72 46 69 74 7a 70 61  jiModifierFitzpa
0x7ffeefbfe6e0: 74 72 69 63 6b 54 79 70 65 34 00 00 ff 7f 00 00  trickType4..?...
(lldb) 
0x7ffeefbfe6f0: 78 00 0a 7c a5 a1 cd 4e 30 e7 bf ef fe 7f 00 00  x..|???N0???...
0x7ffeefbfe700: 00 de 80 00 01 00 00 00 60 38 06 00 01 00 00 00  .?......`8......
(lldb) 

$ for i in 1672 1673 1674 1675 1676 1678 1679 1680 1681 1682 1854 1855 1856 1857 1858 2114 2115 2116 2117 2118; do cat GlyphOrderAndAliasDB | sed "$i"'!'"d"; done
u1F595_u1F3FB	reversedHandWithMiddleFingerExtended_emojiModifierFitzpatrickType12
u1F595_u1F3FC	reversedHandWithMiddleFingerExtended_emojiModifierFitzpatrickType3
u1F595_u1F3FD	reversedHandWithMiddleFingerExtended_emojiModifierFitzpatrickType4
u1F595_u1F3FE	reversedHandWithMiddleFingerExtended_emojiModifierFitzpatrickType5
u1F595_u1F3FF	reversedHandWithMiddleFingerExtended_emojiModifierFitzpatrickType6
u1F596_u1F3FB	raisedHandWithPartBetweenMiddleAndRingFingers_emojiModifierFitzpatrickType12
u1F596_u1F3FC	raisedHandWithPartBetweenMiddleAndRingFingers_emojiModifierFitzpatrickType3
u1F596_u1F3FD	raisedHandWithPartBetweenMiddleAndRingFingers_emojiModifierFitzpatrickType4
u1F596_u1F3FE	raisedHandWithPartBetweenMiddleAndRingFingers_emojiModifierFitzpatrickType5
u1F596_u1F3FF	raisedHandWithPartBetweenMiddleAndRingFingers_emojiModifierFitzpatrickType6
u1F64C_u1F3FB	personRaisingBothHandsInCelebration_emojiModifierFitzpatrickType12
u1F64C_u1F3FC	personRaisingBothHandsInCelebration_emojiModifierFitzpatrickType3
u1F64C_u1F3FD	personRaisingBothHandsInCelebration_emojiModifierFitzpatrickType4
u1F64C_u1F3FE	personRaisingBothHandsInCelebration_emojiModifierFitzpatrickType5
u1F64C_u1F3FF	personRaisingBothHandsInCelebration_emojiModifierFitzpatrickType6
u1F91E_u1F3FB	handWithIndexAndMiddleFingersCrossed_emojiModifierFitzpatrickType12
u1F91E_u1F3FC	handWithIndexAndMiddleFingersCrossed_emojiModifierFitzpatrickType3
u1F91E_u1F3FD	handWithIndexAndMiddleFingersCrossed_emojiModifierFitzpatrickType4
u1F91E_u1F3FE	handWithIndexAndMiddleFingersCrossed_emojiModifierFitzpatrickType5
u1F91E_u1F3FF	handWithIndexAndMiddleFingersCrossed_emojiModifierFitzpatrickType6

This can be mitigated successfully by perl -pi -e 's/ModifierFitzpatrick/MF/g' foo.glyphs before opening and exporting, fwiw.

Thanks for the report. I’ll check if I can fix makeOTF. And I’ll try to shorten the names a bit.

1 Like

thanks. to be clear, the glyph names were the ones autogenerated by Glyphs for the imported ligatures in question; this is the app rather than me picking crazy long names :slight_smile: