Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I found this while debugging #1538, which looks like the problem was mostly solved for by the libxml2 changes in #1515 and #1523. The only remaining issue seems to be the following:
currentiFD
is a variable used to track which font dict index is pointed to in the FDArray. This is used in UFO parsing of fontinfo.plist, as well as glyphs files (in that order). While parsing glyphs files, thecurrentiFD
is changed to -1.mergefonts
parses fontinfo.plist again after the glyphs files, which causes a memory leak in non-M1 and a fail in M1 Macs becausecurrentiFD
should start with 0 (this points to the initial font dictionary).Since the test doesn't fail on non-M1 unless ASAN is enabled, I did not add a new test.
This is a temporary fix as I'll rewrite glyphs parsing when working on #1522
I also included a small fix where the ufoErrSrcStream was being returned instead of ufoSuccess.
Checklist: