[pango/log-attr-tweaks: 35/35] layout: Validate external log attrs
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/log-attr-tweaks: 35/35] layout: Validate external log attrs
- Date: Thu, 26 Aug 2021 12:22:27 +0000 (UTC)
commit 9cdf052c5576cad19e369136c9797d339f8fa5dd
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Aug 21 15:42:18 2021 -0400
layout: Validate external log attrs
These might be nonsense, better do some checks.
pango/pango-layout.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]