[gnome-builder] libide/projects: assert data format between systems
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/projects: assert data format between systems
- Date: Thu, 21 Jul 2022 07:58:05 +0000 (UTC)
commit 33623ca56335cea746bfd2ccaccd94c697a94003
Author: Christian Hergert <chergert redhat com>
Date: Thu Jul 21 00:58:00 2022 -0700
libide/projects: assert data format between systems
src/libide/code/ide-language.c | 9 +++++----
src/libide/projects/ide-template-locator.c | 3 +++
2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/code/ide-language.c b/src/libide/code/ide-language.c
index da674ba8c..503747c60 100644
--- a/src/libide/code/ide-language.c
+++ b/src/libide/code/ide-language.c
@@ -33,16 +33,17 @@ ide_language_format_header (GtkSourceLanguage *self,
const gchar *header)
{
IdeLineReader reader;
- const gchar *first_prefix;
- const gchar *last_prefix;
- const gchar *line_prefix;
- const gchar *line;
+ const char *first_prefix;
+ const char *last_prefix;
+ const char *line_prefix;
+ const char *line;
gboolean first = TRUE;
GString *outstr;
gsize len;
guint prefix_len;
g_return_val_if_fail (GTK_SOURCE_IS_LANGUAGE (self), NULL);
+ g_return_val_if_fail (header == NULL || g_utf8_validate (header, -1, NULL), NULL);
if (ide_str_empty0 (header))
return g_strdup ("");
diff --git a/src/libide/projects/ide-template-locator.c b/src/libide/projects/ide-template-locator.c
index 6763c56d8..ec58772ce 100644
--- a/src/libide/projects/ide-template-locator.c
+++ b/src/libide/projects/ide-template-locator.c
@@ -53,6 +53,7 @@ ide_template_locator_locate (TmplTemplateLocator *locator,
g_assert (IDE_IS_TEMPLATE_LOCATOR (self));
g_assert (path != NULL);
+ g_assert (priv->license_text == NULL || g_utf8_validate (priv->license_text, -1, NULL));
if (g_str_has_prefix (path, "license."))
{
@@ -64,6 +65,8 @@ ide_template_locator_locate (TmplTemplateLocator *locator,
g_autofree char *header = ide_language_format_header (language, priv->license_text);
gsize len = strlen (header);
+ g_assert (g_utf8_validate (header, -1, NULL));
+
return g_memory_input_stream_new_from_data (g_steal_pointer (&header), len, g_free);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]