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

[mergefonts] explicitly zero out new dynamic array memory #795

Merged
merged 4 commits into from
May 9, 2019

Conversation

cjchapman
Copy link
Contributor

The primary change in this PR is the addition of code to explicitly set new memory to zero when a dynamic array grows. This fixes a bug in mergefonts in which it would fail on a semi-random glyph with the message mergefonts: (cfr) charstring parse error.

In the process of tracking down that problem, I fixed a couple of other memory issues which reported by Xcode's memory diagnostics. One was memory that was getting freed before it was used. The other was an incorrect variable type that was causing a pointer alignment issue.

Along the way, I also updated several Xcode project files semi-automatically with the changes recommended by Xcode 10.2.1.

this fixes an instance of "ERROR: AddressSanitizer: stack-buffer-overflow"
this fixes an instance of "ERROR: AddressSanitizer: heap-use-after-free"
this fixes semi-random instances of "charstring parse error" in mergefonts
@cjchapman cjchapman requested a review from miguelsousa May 9, 2019 20:07
@miguelsousa miguelsousa merged commit e25ae14 into develop May 9, 2019
@miguelsousa miguelsousa deleted the cjc-fix-mergefont-charstring-bug branch May 9, 2019 20:32
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

Successfully merging this pull request may close these issues.

2 participants