-
Notifications
You must be signed in to change notification settings - Fork 610
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
[subset] Drop glyph names from post when subsetting. #868
Conversation
src/hb-ot-post-table.hh
Outdated
hb_blob_t *post_blob = OT::Sanitizer<post>().sanitize (hb_face_reference_table (plan->source, HB_OT_TAG_post)); | ||
post *post_table = (post *) hb_blob_get_data (post_blob, nullptr); | ||
|
||
post *post_prime = (post *) malloc (post::static_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please allocate fixed-size objects using calloc(..., 1).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reworked to use create sub blob.
src/hb-ot-post-table.hh
Outdated
return false; | ||
} | ||
|
||
memcpy (post_prime, post_table, post::static_size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually does out-of-memory access if post_table is too short. Let me think what I suggest to use instead.
An idiom instead of malloc+memcpy is to create_sub_blob().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Reworked to use create sub blob.
No description provided.