From fbfc57796a6ddb398fa6ad5bccf25602498bf805 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Fri, 16 Feb 2018 11:41:26 -0500 Subject: [PATCH] Be more strict with certain parser edge-cases - Replace popt argument processing with glib - Drop upstreamed patches Signed-off-by: Stephen Gallagher --- .gitignore | 1 + ...ricter-about-simpleset_from_sequence.patch | 54 ------------------- ...tricter-about-hashtable_from_mapping.patch | 54 ------------------- libmodulemd.spec | 14 ++--- sources | 2 +- 5 files changed, 9 insertions(+), 116 deletions(-) delete mode 100644 0001-Be-stricter-about-simpleset_from_sequence.patch delete mode 100644 0002-Be-stricter-about-hashtable_from_mapping.patch diff --git a/.gitignore b/.gitignore index a49e0cf..9835154 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /modulemd-0.2.2.tar.xz /modulemd-1.0.0.tar.xz /modulemd-1.0.1.tar.xz +/modulemd-1.0.2.tar.xz diff --git a/0001-Be-stricter-about-simpleset_from_sequence.patch b/0001-Be-stricter-about-simpleset_from_sequence.patch deleted file mode 100644 index e771fc8..0000000 --- a/0001-Be-stricter-about-simpleset_from_sequence.patch +++ /dev/null @@ -1,54 +0,0 @@ -From e44cb185d1e6d18960c648b8233e4a71e458444f Mon Sep 17 00:00:00 2001 -From: Stephen Gallagher -Date: Thu, 15 Feb 2018 20:30:12 -0500 -Subject: [PATCH] Be stricter about simpleset_from_sequence - -Signed-off-by: Stephen Gallagher ---- - modulemd/modulemd-yaml-parser.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/modulemd/modulemd-yaml-parser.c b/modulemd/modulemd-yaml-parser.c -index a1d2a3ed7ee0f89f4e0950710c79747743778d13..16daaddff1e1f82ba6761c39ba47819e5e2a281b 100644 ---- a/modulemd/modulemd-yaml-parser.c -+++ b/modulemd/modulemd-yaml-parser.c -@@ -2257,10 +2257,11 @@ static gboolean - _simpleset_from_sequence (yaml_parser_t *parser, - ModulemdSimpleSet **_set, - GError **error) - { - yaml_event_t event; -+ gboolean started = FALSE; - gboolean done = FALSE; - ModulemdSimpleSet *set = NULL; - - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - -@@ -2276,18 +2277,24 @@ _simpleset_from_sequence (yaml_parser_t *parser, - - switch (event.type) - { - case YAML_SEQUENCE_START_EVENT: - /* Sequence has begun */ -+ started = TRUE; - break; - - case YAML_SEQUENCE_END_EVENT: - /* Sequence has concluded. Return */ - done = TRUE; - break; - - case YAML_SCALAR_EVENT: -+ if (!started) -+ { -+ MMD_YAML_ERROR_RETURN ( -+ error, "Received scalar where sequence expected"); -+ } - modulemd_simpleset_add (set, (const gchar *)event.data.scalar.value); - break; - - default: - /* We received a YAML event we shouldn't expect at this level */ --- -2.14.3 - diff --git a/0002-Be-stricter-about-hashtable_from_mapping.patch b/0002-Be-stricter-about-hashtable_from_mapping.patch deleted file mode 100644 index 0848cba..0000000 --- a/0002-Be-stricter-about-hashtable_from_mapping.patch +++ /dev/null @@ -1,54 +0,0 @@ -From ef2e8b4914feea9b717f71dd381bf1ff09b493ea Mon Sep 17 00:00:00 2001 -From: Stephen Gallagher -Date: Thu, 15 Feb 2018 20:35:56 -0500 -Subject: [PATCH 2/2] Be stricter about hashtable_from_mapping - -Signed-off-by: Stephen Gallagher ---- - modulemd/modulemd-yaml-parser.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/modulemd/modulemd-yaml-parser.c b/modulemd/modulemd-yaml-parser.c -index 064135fc45b15df608b4bc636c64ca736bd789ef..ebdb63abb9b970834a8e8f8859345d9adc152d9a 100644 ---- a/modulemd/modulemd-yaml-parser.c -+++ b/modulemd/modulemd-yaml-parser.c -@@ -2320,10 +2320,11 @@ static gboolean - _hashtable_from_mapping (yaml_parser_t *parser, - GHashTable **_htable, - GError **error) - { - yaml_event_t event; -+ gboolean started = FALSE; - gboolean done = FALSE; - GHashTable *htable = NULL; - gchar *name = NULL; - gchar *value = NULL; - -@@ -2339,18 +2340,24 @@ _hashtable_from_mapping (yaml_parser_t *parser, - - switch (event.type) - { - case YAML_MAPPING_START_EVENT: - /* The dictionary has begun */ -+ started = TRUE; - break; - - case YAML_MAPPING_END_EVENT: - /* We've processed the whole dictionary */ - done = TRUE; - break; - - case YAML_SCALAR_EVENT: -+ if (!started) -+ { -+ MMD_YAML_ERROR_RETURN ( -+ error, "Received scalar where mapping expected"); -+ } - name = g_strdup ((const gchar *)event.data.scalar.value); - YAML_PARSER_PARSE_WITH_ERROR_RETURN ( - parser, &event, error, "Parser error"); - if (event.type != YAML_SCALAR_EVENT) - { --- -2.14.3 - diff --git a/libmodulemd.spec b/libmodulemd.spec index 3c922a7..6b471b0 100644 --- a/libmodulemd.spec +++ b/libmodulemd.spec @@ -1,11 +1,11 @@ %global majorversion 1 %global minorversion 0 -%global patchversion 1 +%global patchversion 2 %global majorminorversion %{majorversion}.%{minorversion} Name: libmodulemd Version: %{majorminorversion}%{?patchversion:.%{patchversion}} -Release: 2%{?dist} +Release: 1%{?dist} Summary: Module metadata manipulation library License: MIT @@ -18,14 +18,9 @@ BuildRequires: pkgconfig(gobject-2.0) BuildRequires: pkgconfig(gobject-introspection-1.0) BuildRequires: pkgconfig(yaml-0.1) BuildRequires: pkgconfig(gtk-doc) -BuildRequires: pkgconfig(popt) # Patches -# Upstream patches for proper sequence and mapping validation -Patch0001: 0001-Be-stricter-about-simpleset_from_sequence.patch -Patch0002: 0002-Be-stricter-about-hashtable_from_mapping.patch - %description C Library for manipulating module metadata files. See https://pagure.io/modulemd for more details. @@ -72,6 +67,11 @@ export LC_CTYPE=C.utf8 %{_datadir}/gtk-doc/html/modulemd/ %changelog +* Fri Feb 16 2018 Stephen Gallagher - 1.0.2-1 +- Be more strict with certain parser edge-cases +- Replace popt argument processing with glib +- Drop upstreamed patches + * Thu Feb 15 2018 Stephen Gallagher - 1.0.1-2 - Handle certain unlikely format violations diff --git a/sources b/sources index e8a167b..64c0eca 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (modulemd-1.0.1.tar.xz) = b1b0c4e4bf75b4d7152ce76fc67189511a362a9c69a1ed708eed7004ed6dc4a31e2cc1bcd9364c38c58579d9176a567d6e870a4e3e6660b97e9108e9610c0cd3 +SHA512 (modulemd-1.0.2.tar.xz) = bd384ea1a806c18cb01ed874e4b7fa545fa3dbade705420cb7512af1aa726fd6d1ec4860f4791efae49b100dde4281967d7c42134a3adea6f17315edc11020b7