Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

malloc: Heap corruption detected, free list is damaged #24

Open
anthrotype opened this issue Nov 5, 2024 · 3 comments
Open

malloc: Heap corruption detected, free list is damaged #24

anthrotype opened this issue Nov 5, 2024 · 3 comments

Comments

@anthrotype
Copy link
Member

original issue with reproducer googlefonts/gftools#1056

@anthrotype
Copy link
Member Author

hm the glyf table from the test font that @cmyr attached to the above linked issue (Yarndings20-Regular.ttf.zip actually fails to be decompiled by fonttools ttx with the following error:

$ ttx /Users/clupo/Downloads/Yarndings20-Regular.ttf
Dumping "/Users/clupo/Downloads/Yarndings20-Regular.ttf" to "/Users/clupo/Downloads/Yarndings20-Regular#1.ttx"...
Dumping 'GlyphOrder' table...
Dumping 'head' table...
Dumping 'hhea' table...
Dumping 'maxp' table...
Dumping 'OS/2' table...
Dumping 'hmtx' table...
Dumping 'cmap' table...
Dumping 'fpgm' table...
Dumping 'prep' table...
Dumping 'cvt ' table...
Dumping 'loca' table...
Dumping 'glyf' table...
ERROR: An exception occurred during the decompilation of glyph program:

Traceback (most recent call last):
  File "/Users/clupo/oss/ttfautohint-py/.venv/lib/python3.13/site-packages/fontTools/ttLib/tables/ttProgram.py", line 478, in _disassemble
    mnemonic, argBits, argoffset, name = opcodeDict[op]
                                         ~~~~~~~~~~^^^^
KeyError: 191

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/clupo/oss/ttfautohint-py/.venv/lib/python3.13/site-packages/fontTools/ttLib/tables/ttProgram.py", line 254, in toXML
    assembly = self.getAssembly()
  File "/Users/clupo/oss/ttfautohint-py/.venv/lib/python3.13/site-packages/fontTools/ttLib/tables/ttProgram.py", line 245, in getAssembly
    self._disassemble(preserve=preserve)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/Users/clupo/oss/ttfautohint-py/.venv/lib/python3.13/site-packages/fontTools/ttLib/tables/ttProgram.py", line 503, in _disassemble
    value = (bytecode[i] << 8) | bytecode[i + 1]
             ~~~~~~~~^^^
IndexError: array index out of range

ERROR: An exception occurred during the decompilation of glyph program:

Traceback (most recent call last):
  File "/Users/clupo/oss/ttfautohint-py/.venv/lib/python3.13/site-packages/fontTools/ttLib/tables/ttProgram.py", line 478, in _disassemble
    mnemonic, argBits, argoffset, name = opcodeDict[op]
                                         ~~~~~~~~~~^^^^
KeyError: 64

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/clupo/oss/ttfautohint-py/.venv/lib/python3.13/site-packages/fontTools/ttLib/tables/ttProgram.py", line 254, in toXML
    assembly = self.getAssembly()
  File "/Users/clupo/oss/ttfautohint-py/.venv/lib/python3.13/site-packages/fontTools/ttLib/tables/ttProgram.py", line 245, in getAssembly
    self._disassemble(preserve=preserve)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/Users/clupo/oss/ttfautohint-py/.venv/lib/python3.13/site-packages/fontTools/ttLib/tables/ttProgram.py", line 497, in _disassemble
    value = bytecode[i]
            ~~~~~~~~^^^
IndexError: array index out of range

Dumping 'name' table...
Dumping 'post' table...
Dumping 'gasp' table...

maybe this is what causes a buffer overflow somewhere in libttfautohint?

Where does that font come from?

@cmyr
Copy link

cmyr commented Nov 5, 2024

the file was compiled by source from https://github.com/scfried/soft-type-yarndings.

@anthrotype
Copy link
Member Author

anthrotype commented Nov 5, 2024

i banged my head today on this but could not find the root cause.. I can't reproduce with vanilla ttfautohint executable (the original upstream C++ one). I wrote this 7 years ago and forgot almost everything.. 😳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants