From: Behdad Esfahbod Date: Thu, 22 Apr 2010 15:06:30 +0000 (-0400) Subject: Don't sanitize raw table data X-Git-Tag: 2.0_alpha~7^2~818 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8015a8c762dc7be36998d529b7a3af59e3d14d87;p=apps%2Fhome%2Fvideo-player.git Don't sanitize raw table data That part is performed by individual table sanitize. --- diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index bd8a022..993e7eb 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -49,10 +49,9 @@ typedef struct TableDirectory { static inline unsigned int get_size () { return sizeof (TableDirectory); } - inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { + inline bool sanitize (SANITIZE_ARG_DEF) { TRACE_SANITIZE (); - return SANITIZE_SELF () && SANITIZE (tag) && - SANITIZE_MEM (CharP(base) + (unsigned long) offset, length); + return SANITIZE_SELF (); } Tag tag; /* 4-byte identifier. */ @@ -109,12 +108,16 @@ typedef struct OffsetTable inline unsigned int get_face_count (void) const { return 1; } public: - inline bool sanitize (SANITIZE_ARG_DEF, const void *base) { + inline bool sanitize (SANITIZE_ARG_DEF, void *base) { TRACE_SANITIZE (); if (!(SANITIZE_SELF () && SANITIZE_ARRAY (tableDir, TableDirectory::get_size (), numTables))) return false; + 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_BASE (tableDir[i], base)) + if (!SANITIZE (tableDir[i])) return false; return true; } @@ -200,7 +203,7 @@ struct OpenTypeFontFile inline const char* get_table_data (const OpenTypeTable& table) const { if (HB_UNLIKELY (table.offset == 0)) return NULL; - return ((const char*) this) + table.offset; + return CharP(this) + table.offset; } inline bool sanitize (SANITIZE_ARG_DEF) {