[repacker] Check for nullptr's before sanitizing.
This commit is contained in:
parent
13253233f7
commit
163fbf0be1
|
@ -66,7 +66,7 @@ struct Coverage : public OT::Layout::Common::Coverage
|
|||
unsigned coverage_size = c.graph.vertices_[coverage_id].table_size ();
|
||||
auto& coverage_v = c.graph.vertices_[coverage_id];
|
||||
Coverage* coverage_table = (Coverage*) coverage_v.obj.head;
|
||||
if (!coverage_table->sanitize (coverage_v))
|
||||
if (!coverage_table || !coverage_table->sanitize (coverage_v))
|
||||
return nullptr;
|
||||
|
||||
auto new_coverage =
|
||||
|
|
|
@ -133,7 +133,7 @@ struct Lookup : public OT::Lookup
|
|||
ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>* extension =
|
||||
(ExtensionFormat1<OT::Layout::GSUB_impl::ExtensionSubst>*)
|
||||
c.graph.object (ext_subtable_index).head;
|
||||
if (!extension->sanitize (c.graph.vertices_[ext_subtable_index]))
|
||||
if (!extension || !extension->sanitize (c.graph.vertices_[ext_subtable_index]))
|
||||
continue;
|
||||
|
||||
subtable_index = extension->get_subtable_index (c.graph, ext_subtable_index);
|
||||
|
@ -143,7 +143,7 @@ struct Lookup : public OT::Lookup
|
|||
}
|
||||
|
||||
PairPos* pairPos = (PairPos*) c.graph.object (subtable_index).head;
|
||||
if (!pairPos->sanitize (c.graph.vertices_[subtable_index])) continue;
|
||||
if (!pairPos || !pairPos->sanitize (c.graph.vertices_[subtable_index])) continue;
|
||||
|
||||
hb_vector_t<unsigned> new_sub_tables = pairPos->split_subtables (c, subtable_index);
|
||||
if (new_sub_tables.in_error ()) return false;
|
||||
|
@ -320,7 +320,7 @@ struct GSTAR : public OT::GSUBGPOS
|
|||
const auto& r = graph.root ();
|
||||
|
||||
GSTAR* gstar = (GSTAR*) r.obj.head;
|
||||
if (!gstar->sanitize (r))
|
||||
if (!gstar || !gstar->sanitize (r))
|
||||
return nullptr;
|
||||
|
||||
return gstar;
|
||||
|
@ -366,17 +366,16 @@ struct GSTAR : public OT::GSUBGPOS
|
|||
hb_hashmap_t<unsigned, Lookup*>& lookups /* OUT */)
|
||||
{
|
||||
unsigned lookup_list_idx = get_lookup_list_index (graph);
|
||||
|
||||
const LookupList<Types>* lookupList =
|
||||
(const LookupList<Types>*) graph.object (lookup_list_idx).head;
|
||||
if (!lookupList->sanitize (graph.vertices_[lookup_list_idx]))
|
||||
if (!lookupList || !lookupList->sanitize (graph.vertices_[lookup_list_idx]))
|
||||
return;
|
||||
|
||||
for (unsigned i = 0; i < lookupList->len; i++)
|
||||
{
|
||||
unsigned lookup_idx = graph.index_for_offset (lookup_list_idx, &(lookupList->arrayZ[i]));
|
||||
Lookup* lookup = (Lookup*) graph.object (lookup_idx).head;
|
||||
if (!lookup->sanitize (graph.vertices_[lookup_idx])) continue;
|
||||
if (!lookup || !lookup->sanitize (graph.vertices_[lookup_idx])) continue;
|
||||
lookups.set (lookup_idx, lookup);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ struct PairPosFormat1 : public OT::Layout::GPOS_impl::PairPosFormat1_3<SmallType
|
|||
auto& coverage_v = c.graph.vertices_[coverage_id];
|
||||
|
||||
Coverage* coverage_table = (Coverage*) coverage_v.obj.head;
|
||||
if (!coverage_table->sanitize (coverage_v))
|
||||
if (!coverage_table || !coverage_table->sanitize (coverage_v))
|
||||
return false;
|
||||
|
||||
auto new_coverage =
|
||||
|
@ -377,7 +377,9 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4<SmallType
|
|||
auto& class_def_1_v = graph.vertices_[class_def_1_id];
|
||||
Coverage* coverage_table = (Coverage*) coverage_v.obj.head;
|
||||
ClassDef* class_def_1_table = (ClassDef*) class_def_1_v.obj.head;
|
||||
if (!coverage_table->sanitize (coverage_v)
|
||||
if (!coverage_table
|
||||
|| !coverage_table->sanitize (coverage_v)
|
||||
|| !class_def_1_table
|
||||
|| !class_def_1_table->sanitize (class_def_1_v))
|
||||
return -1;
|
||||
|
||||
|
@ -513,7 +515,9 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4<SmallType
|
|||
auto& class_def_1_v = graph.vertices_[class_def_1_id];
|
||||
Coverage* coverage_table = (Coverage*) coverage_v.obj.head;
|
||||
ClassDef* class_def_1_table = (ClassDef*) class_def_1_v.obj.head;
|
||||
if (!coverage_table->sanitize (coverage_v)
|
||||
if (!coverage_table
|
||||
|| !coverage_table->sanitize (coverage_v)
|
||||
|| !class_def_1_table
|
||||
|| !class_def_1_table->sanitize (class_def_1_v))
|
||||
return false;
|
||||
|
||||
|
@ -560,7 +564,7 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4<SmallType
|
|||
auto& coverage_v = c.graph.vertices_[coverage_id];
|
||||
|
||||
Coverage* coverage_table = (Coverage*) coverage_v.obj.head;
|
||||
if (!coverage_table->sanitize (coverage_v))
|
||||
if (!coverage_table || !coverage_table->sanitize (coverage_v))
|
||||
return &Null(Coverage);
|
||||
return coverage_table;
|
||||
}
|
||||
|
@ -572,7 +576,7 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4<SmallType
|
|||
auto& class_def_1_v = c.graph.vertices_[class_def_1_id];
|
||||
|
||||
ClassDef* class_def_1_table = (ClassDef*) class_def_1_v.obj.head;
|
||||
if (!class_def_1_table->sanitize (class_def_1_v))
|
||||
if (!class_def_1_table || !class_def_1_table->sanitize (class_def_1_v))
|
||||
return &Null(ClassDef);
|
||||
return class_def_1_table;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue