mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-07 06:25:03 +00:00
[face] Avoid edit-sanitizing in hb_face_count()
This commit is contained in:
parent
e4fe8bf95e
commit
8ca9fe7617
1 changed files with 7 additions and 7 deletions
|
@ -79,14 +79,14 @@ hb_face_count (hb_blob_t *blob)
|
|||
if (unlikely (!blob))
|
||||
return 0;
|
||||
|
||||
/* TODO We shouldn't be sanitizing blob. Port to run sanitizer and return if not sane. */
|
||||
/* Make API signature const after. */
|
||||
hb_blob_t *sanitized = hb_sanitize_context_t ().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob));
|
||||
const OT::OpenTypeFontFile& ot = *sanitized->as<OT::OpenTypeFontFile> ();
|
||||
unsigned int ret = ot.get_face_count ();
|
||||
hb_blob_destroy (sanitized);
|
||||
hb_sanitize_context_t c (blob);
|
||||
|
||||
return ret;
|
||||
const char *start = hb_blob_get_data (blob, nullptr);
|
||||
auto *ot = reinterpret_cast<OT::OpenTypeFontFile *> (const_cast<char *> (start));
|
||||
if (unlikely (!ot->sanitize (&c)))
|
||||
return 0;
|
||||
|
||||
return ot->get_face_count ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue