More sanitize cleanup
This commit is contained in:
parent
278a91f0cd
commit
df3f505dcf
|
@ -110,16 +110,7 @@ typedef struct OffsetTable
|
||||||
public:
|
public:
|
||||||
inline bool sanitize (SANITIZE_ARG_DEF, void *base) {
|
inline bool sanitize (SANITIZE_ARG_DEF, void *base) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!(SANITIZE_SELF () && SANITIZE_ARRAY (tableDir, TableDirectory::get_size (), numTables))) return false;
|
return SANITIZE_SELF () && SANITIZE_ARRAY (tableDir, TableDirectory::get_size (), numTables);
|
||||||
return true;
|
|
||||||
/* No need to check tables individually since we don't sanitize the
|
|
||||||
* referenced table, just the table directory. Code retaind to make
|
|
||||||
* sure TableDirectory has a baseless sanitize(). */
|
|
||||||
unsigned int count = numTables;
|
|
||||||
for (unsigned int i = 0; i < count; i++)
|
|
||||||
if (!SANITIZE (tableDir[i]))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -143,11 +134,7 @@ struct TTCHeader
|
||||||
STATIC_DEFINE_GET_FOR_DATA_CHECK_MAJOR_VERSION (TTCHeader, 1, 2);
|
STATIC_DEFINE_GET_FOR_DATA_CHECK_MAJOR_VERSION (TTCHeader, 1, 2);
|
||||||
|
|
||||||
inline unsigned int get_face_count (void) const { return table.len; }
|
inline unsigned int get_face_count (void) const { return table.len; }
|
||||||
|
inline const OpenTypeFontFace& get_face (unsigned int i) const { return this+table[i]; }
|
||||||
inline const OpenTypeFontFace& get_face (unsigned int i) const
|
|
||||||
{
|
|
||||||
return this+table[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool sanitize (SANITIZE_ARG_DEF) {
|
inline bool sanitize (SANITIZE_ARG_DEF) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
|
@ -199,13 +186,6 @@ struct OpenTypeFontFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is how you get a table */
|
|
||||||
inline const char* get_table_data (const OpenTypeTable& table) const
|
|
||||||
{
|
|
||||||
if (HB_UNLIKELY (table.offset == 0)) return NULL;
|
|
||||||
return CharP(this) + table.offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool sanitize (SANITIZE_ARG_DEF) {
|
inline bool sanitize (SANITIZE_ARG_DEF) {
|
||||||
TRACE_SANITIZE ();
|
TRACE_SANITIZE ();
|
||||||
if (!SANITIZE_SELF ()) return false;
|
if (!SANITIZE_SELF ()) return false;
|
||||||
|
|
|
@ -99,7 +99,7 @@ main (int argc, char **argv)
|
||||||
case GSUBGPOS::GPOSTag:
|
case GSUBGPOS::GPOSTag:
|
||||||
{
|
{
|
||||||
|
|
||||||
const GSUBGPOS &g = GSUBGPOS::get_for_data (ot.get_table_data (table));
|
const GSUBGPOS &g = GSUBGPOS::get_for_data ((const char *) &ot + table.offset);
|
||||||
|
|
||||||
int num_scripts = g.get_script_count ();
|
int num_scripts = g.get_script_count ();
|
||||||
printf (" %d script(s) found in table\n", num_scripts);
|
printf (" %d script(s) found in table\n", num_scripts);
|
||||||
|
@ -162,7 +162,7 @@ main (int argc, char **argv)
|
||||||
case GDEF::Tag:
|
case GDEF::Tag:
|
||||||
{
|
{
|
||||||
|
|
||||||
const GDEF &gdef = GDEF::get_for_data (ot.get_table_data (table));
|
const GDEF &gdef = GDEF::get_for_data ((const char *) &ot + table.offset);
|
||||||
|
|
||||||
printf (" Has %sglyph classes\n",
|
printf (" Has %sglyph classes\n",
|
||||||
gdef.has_glyph_classes () ? "" : "no ");
|
gdef.has_glyph_classes () ? "" : "no ");
|
||||||
|
|
Loading…
Reference in New Issue