Revert file blob sanitization and index checking (#1062)
authorEbrahim Byagowi <ebrahim@gnu.org>
Mon, 18 Jun 2018 15:29:33 +0000 (19:59 +0430)
committerGitHub <noreply@github.com>
Mon, 18 Jun 2018 15:29:33 +0000 (19:59 +0430)
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.

util/options.cc
util/options.hh

index 299466f..682e40c 100644 (file)
@@ -670,16 +670,8 @@ font_options_t::get_font (void) const
     blob = hb_blob_create_from_file (font_file);
   }
 
-  if (hb_blob_get_length (blob) == 0)
-    fail (false, "No such file or directory, or is empty");
-
-  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");
+  if (blob == hb_blob_get_empty ())
+    fail (false, "No such file or directory");
 
   /* Create the face */
   hb_face_t *face = hb_face_create (blob, face_index);
index 5287395..2160d5e 100644 (file)
@@ -485,7 +485,7 @@ struct font_options_t : option_group_t
   mutable double font_size_y;
   char *font_funcs;
 
-private:
+  private:
   mutable hb_font_t *font;
 };