Fail sanitize on major version mismatch

We handle major-version differences via get_for_data(), so sanitize
should never see a major version mismatch.
This commit is contained in:
Behdad Esfahbod 2010-04-22 14:15:11 -04:00
parent df3f505dcf
commit 1856184b93
3 changed files with 4 additions and 4 deletions

View File

@ -139,8 +139,8 @@ struct TTCHeader
inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE ();
if (!SANITIZE (version)) return false;
if (version.major < 1 || version.major > 2) return true;
return table.sanitize (SANITIZE_ARG, CharP(this), CharP(this));
if (HB_UNLIKELY (version.major < 1 || version.major > 2)) return false;
return HB_LIKELY (table.sanitize (SANITIZE_ARG, CharP(this), CharP(this)));
}
private:

View File

@ -346,7 +346,7 @@ struct GDEF
inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE ();
if (!SANITIZE (version)) return false;
if (version.major != 1) return true;
if (HB_UNLIKELY (version.major != 1)) return false;
return SANITIZE_THIS2 (glyphClassDef, attachList) &&
SANITIZE_THIS2 (ligCaretList, markAttachClassDef) &&
(version < 0x00010002 || SANITIZE_THIS (markGlyphSetsDef[0]));

View File

@ -937,7 +937,7 @@ struct GSUBGPOS
inline bool sanitize (SANITIZE_ARG_DEF) {
TRACE_SANITIZE ();
if (!SANITIZE (version)) return false;
if (version.major != 1) return true;
if (HB_UNLIKELY (version.major != 1)) return false;
return SANITIZE_THIS3 (scriptList, featureList, lookupList);
}