diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-08-21 15:42:18 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-08-26 08:22:17 -0400 |
commit | 9cdf052c5576cad19e369136c9797d339f8fa5dd (patch) | |
tree | 1674559465ec7b27412eb0a29f9a47a676ba7862 | |
parent | 0bd8bc300f838da4ba2fa01e2785bf3cf0865a4b (diff) | |
download | pango-log-attr-tweaks.tar.gz |
layout: Validate external log attrslog-attr-tweaks
These might be nonsense, better do some checks.
-rw-r--r-- | pango/pango-layout.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index e5e4806e..94259383 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -1591,7 +1591,14 @@ pango_layout_set_log_attrs (PangoLayout *layout, const PangoLogAttr *attrs, int n_attrs) { - g_return_if_fail (layout->n_chars + 1 == n_attrs); + GError *error = NULL; + + if (!pango_validate_log_attrs (layout->text, layout->length, attrs, n_attrs, &error)) + { + g_warning ("pango_layout_set_log_attrs: %s", error->message); + g_error_free (error); + return; + } if (!layout->log_attrs) layout->log_attrs = g_new (PangoLogAttr, layout->n_chars + 1); |