Check for (impossible) overflow

This commit is contained in:
Behdad Esfahbod 2010-04-22 13:50:22 -04:00
parent 9fc8684fd8
commit 9ac7dc73bc
1 changed files with 1 additions and 0 deletions

View File

@ -322,6 +322,7 @@ struct AnchorMatrix
inline bool sanitize (SANITIZE_ARG_DEF, unsigned int cols) { inline bool sanitize (SANITIZE_ARG_DEF, unsigned int cols) {
TRACE_SANITIZE (); TRACE_SANITIZE ();
if (!SANITIZE_SELF ()) return false; if (!SANITIZE_SELF ()) return false;
if (HB_UNLIKELY (cols >= ((unsigned int) -1) / rows)) return false;
unsigned int count = rows * cols; unsigned int count = rows * cols;
if (!SANITIZE_ARRAY (matrix, matrix[0].get_size (), count)) return false; if (!SANITIZE_ARRAY (matrix, matrix[0].get_size (), count)) return false;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)