Revert file blob sanitization and index checking (#1062)

As https://github.com/harfbuzz/harfbuzz/pull/1059#issuecomment-397912812 we
like to still work with blobs that harfbuzz itself can't handle directly that are failing sanitization
currently apparently.
This commit is contained in:
Ebrahim Byagowi 2018-06-18 19:59:33 +04:30 committed by GitHub
parent c53697d3f2
commit d0c2889dfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 11 deletions

View File

@ -670,16 +670,8 @@ font_options_t::get_font (void) const
blob = hb_blob_create_from_file (font_file); blob = hb_blob_create_from_file (font_file);
} }
if (hb_blob_get_length (blob) == 0) if (blob == hb_blob_get_empty ())
fail (false, "No such file or directory, or is empty"); fail (false, "No such file or directory");
unsigned int face_count = hb_face_count (blob);
if (face_count == 0)
fail (false, "Not a font file"); // most likely
if (face_index > face_count)
fail (false, "The requested font index wasn't available in the file");
/* Create the face */ /* Create the face */
hb_face_t *face = hb_face_create (blob, face_index); hb_face_t *face = hb_face_create (blob, face_index);