diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2009-08-04 21:32:57 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-08-04 21:32:57 -0400 |
commit | 23663fe3b506d0f9b44168dcf0b0a80d102b0877 (patch) | |
tree | ef29d19228b428c583bc4bbaa28762f4c7ff88eb | |
parent | d55d065f2ad518879ae1992f13d1b86e109548a1 (diff) | |
download | pango-23663fe3b506d0f9b44168dcf0b0a80d102b0877.tar.gz |
[HB] Hook Sanitizer up. Hell's breaking loose right now
-rw-r--r-- | pango/opentype/hb-font.cc | 7 | ||||
-rw-r--r-- | pango/opentype/hb-open-types-private.hh | 2 | ||||
-rw-r--r-- | pango/opentype/hb-ot-layout.cc | 12 |
3 files changed, 9 insertions, 12 deletions
diff --git a/pango/opentype/hb-font.cc b/pango/opentype/hb-font.cc index 9aaefdeb..b22dc015 100644 --- a/pango/opentype/hb-font.cc +++ b/pango/opentype/hb-font.cc @@ -165,11 +165,8 @@ static hb_blob_t * _hb_face_get_table_from_blob (hb_tag_t tag, void *user_data) { hb_face_t *face = (hb_face_t *) user_data; - const char *data = hb_blob_lock (face->blob); - /* XXX sanitize */ - - const OpenTypeFontFile &ot_file = OpenTypeFontFile::get_for_data (data); + const OpenTypeFontFile &ot_file = Sanitizer<OpenTypeFontFile>::lock_instance (face->blob); const OpenTypeFontFace &ot_face = ot_file.get_face (face->index); const OpenTypeTable &table = ot_face.get_table_by_tag (tag); @@ -226,7 +223,7 @@ hb_face_create_for_data (hb_blob_t *blob, if (!HB_OBJECT_DO_CREATE (hb_face_t, face)) return &_hb_face_nil; - face->blob = hb_blob_reference (blob); + face->blob = Sanitizer<OpenTypeFontFile>::sanitize (hb_blob_reference (blob)); face->index = index; face->get_table = _hb_face_get_table_from_blob; face->user_data = face; diff --git a/pango/opentype/hb-open-types-private.hh b/pango/opentype/hb-open-types-private.hh index 1ec7d1eb..1af7c08a 100644 --- a/pango/opentype/hb-open-types-private.hh +++ b/pango/opentype/hb-open-types-private.hh @@ -304,7 +304,7 @@ struct Sanitizer } } - static const Type& instantiate (hb_blob_t *blob) { + static const Type& lock_instance (hb_blob_t *blob) { return Type::get_for_data (hb_blob_lock (blob)); } }; diff --git a/pango/opentype/hb-ot-layout.cc b/pango/opentype/hb-ot-layout.cc index ef0a6b12..8699e40f 100644 --- a/pango/opentype/hb-ot-layout.cc +++ b/pango/opentype/hb-ot-layout.cc @@ -46,14 +46,14 @@ _hb_ot_layout_init (hb_face_t *face) /* XXX sanitize */ - layout->gdef_blob = hb_face_get_table (face, HB_OT_TAG_GDEF); - layout->gdef = &GDEF::get_for_data (hb_blob_lock (layout->gdef_blob)); + layout->gdef_blob = Sanitizer<GDEF>::sanitize (hb_face_get_table (face, HB_OT_TAG_GDEF)); + layout->gdef = &Sanitizer<GDEF>::lock_instance (layout->gdef_blob); - layout->gsub_blob = hb_face_get_table (face, HB_OT_TAG_GSUB); - layout->gsub = &GSUB::get_for_data (hb_blob_lock (layout->gsub_blob)); + layout->gsub_blob = Sanitizer<GSUB>::sanitize (hb_face_get_table (face, HB_OT_TAG_GSUB)); + layout->gsub = &Sanitizer<GSUB>::lock_instance (layout->gsub_blob); - layout->gpos_blob = hb_face_get_table (face, HB_OT_TAG_GPOS); - layout->gpos = &GPOS::get_for_data (hb_blob_lock (layout->gpos_blob)); + layout->gpos_blob = Sanitizer<GPOS>::sanitize (hb_face_get_table (face, HB_OT_TAG_GPOS)); + layout->gpos = &Sanitizer<GPOS>::lock_instance (layout->gpos_blob); } void |