Check for (impossible) overflow
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 22 Apr 2010 17:50:22 +0000 (13:50 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 22 Apr 2010 17:50:22 +0000 (13:50 -0400)
src/hb-ot-layout-gpos-private.hh

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