[HarfBuzz] harfbuzz: Branch 'master' - 2 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Mon Feb 25 16:11:26 PST 2013
src/hb-open-type-private.hh | 7 +++++++
src/hb-private.hh | 6 +++++-
2 files changed, 12 insertions(+), 1 deletion(-)
New commits:
commit 07a52b62115f10caea5c2d174a4272eb9ddb2284
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Feb 25 19:09:57 2013 -0500
Give up sanitizing after 100 edit requests
Such fonts are *definitely* really broken. Give up.
Limits time spent in sanitize for extremely / deliberately broken
fonts. For example, two fonts with these md5sum / names:
9343f0a1b8c84b8123e7d201cae62ffd.ttf
eb8c978547f09d368fc204194fb34688.ttf
were spending over a second in sanitize! Not anymore.
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 090f3fc..b337ab7 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -171,6 +171,10 @@ ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
(&c->debug_depth, c->get_name (), this, HB_FUNC, \
"");
+/* This limits sanitizing time on really broken fonts. */
+#ifndef HB_SANITIZE_MAX_EDITS
+#define HB_SANITIZE_MAX_EDITS 100
+#endif
struct hb_sanitize_context_t
{
@@ -247,6 +251,9 @@ struct hb_sanitize_context_t
inline bool may_edit (const void *base HB_UNUSED, unsigned int len HB_UNUSED)
{
+ if (this->edit_count >= HB_SANITIZE_MAX_EDITS)
+ return false;
+
const char *p = (const char *) base;
this->edit_count++;
commit 29ff25481584e20a2fa39195f295c8eb4bf3bad0
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Mon Feb 25 19:04:56 2013 -0500
Add HB_DEBUG_VERBOSE
Only affects the verbosity of function name printing right now.
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 15e4f5f..78a524e 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -594,6 +594,8 @@ _hb_debug_msg_va (const char *what,
if (func)
{
+ unsigned int func_len = strlen (func);
+#ifndef HB_DEBUG_VERBOSE
/* Skip "typename" */
if (0 == strncmp (func, "typename ", 9))
func += 9;
@@ -603,7 +605,9 @@ _hb_debug_msg_va (const char *what,
func = space + 1;
/* Skip parameter list */
const char *paren = strchr (func, '(');
- unsigned int func_len = paren ? paren - func : strlen (func);
+ if (paren)
+ func_len = paren - func;
+#endif
fprintf (stderr, "%.*s: ", func_len, func);
}
More information about the HarfBuzz
mailing list