Port rest of code away from Sanitizer<>

This commit is contained in:
Behdad Esfahbod 2018-07-22 22:49:26 -07:00
parent d6a8f64045
commit 8e3e41272b
2 changed files with 3 additions and 4 deletions

View File

@ -53,7 +53,7 @@ hb_face_count (hb_blob_t *blob)
return 0;
/* TODO We shouldn't be sanitizing blob. Port to run sanitizer and return if not sane. */
hb_blob_t *sanitized = OT::Sanitizer<OT::OpenTypeFontFile> ().sanitize (hb_blob_reference (blob));
hb_blob_t *sanitized = OT::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);
@ -191,7 +191,7 @@ hb_face_create (hb_blob_t *blob,
if (unlikely (!blob))
blob = hb_blob_get_empty ();
hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (OT::Sanitizer<OT::OpenTypeFontFile>().sanitize (hb_blob_reference (blob)), index);
hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (OT::hb_sanitize_context_t().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob)), index);
if (unlikely (!closure))
return hb_face_get_empty ();

View File

@ -51,8 +51,7 @@ main (int argc, char **argv)
const char *font_data = hb_blob_get_data (blob, &len);
printf ("Opened font file %s: %d bytes long\n", argv[1], len);
Sanitizer<OpenTypeFontFile> sanitizer;
hb_blob_t *font_blob = sanitizer.sanitize (blob);
hb_blob_t *font_blob = hb_sanitize_context_t().sanitize_blob<OpenTypeFontFile> (blob);
const OpenTypeFontFile* sanitized = font_blob->as<OpenTypeFontFile> ();
if (sanitized == &Null(OpenTypeFontFile))
{