aboutsummaryrefslogtreecommitdiff
path: root/common/pango.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-04-02 11:53:56 -0400
committerDrew DeVault <sir@cmpwn.com>2018-04-02 11:53:56 -0400
commitc507727ad240b978c6e09e3aa9238080ca9a1c81 (patch)
tree2ef131d4798845e972b3350fa816cc2ea0bca8e1 /common/pango.c
parent0cbd2a4f492b758f495af9f3ec4899dffe8d57d4 (diff)
Fix use-after-free with block hotspots
Diffstat (limited to 'common/pango.c')
-rw-r--r--common/pango.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/common/pango.c b/common/pango.c
index 2ae7883c..658d2876 100644
--- a/common/pango.c
+++ b/common/pango.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "log.h"
PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
const char *text, int32_t scale, bool markup) {
@@ -13,7 +14,13 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
PangoAttrList *attrs;
if (markup) {
char *buf;
- pango_parse_markup(text, -1, 0, &attrs, &buf, NULL, NULL);
+ GError *error = NULL;
+ if (!sway_assert(pango_parse_markup(
+ text, -1, 0, &attrs, &buf, NULL, &error),
+ "pango_parse_markup '%s' -> error %s", text,
+ error ? error->message : NULL)) {
+ return NULL;
+ }
pango_layout_set_markup(layout, buf, -1);
free(buf);
} else {