diff options
author | Richard Hughes <richard@hughsie.com> | 2018-05-21 15:26:41 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2018-05-21 15:30:26 +0100 |
commit | 009cf4f50db852f02926ea0b3c53066fe7cc1ba2 (patch) | |
tree | 0c2d71f4a7a8f485d1dbe806e1631d9d1c84f18d | |
parent | d06e8884439b9574c1921a81988e2f96beb0c8e9 (diff) | |
download | appstream-glib-009cf4f50db852f02926ea0b3c53066fe7cc1ba2.tar.gz |
trivial: Don't crash when validating <id/>
-rw-r--r-- | libappstream-glib/as-app.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libappstream-glib/as-app.c b/libappstream-glib/as-app.c index 3675835..b79c862 100644 --- a/libappstream-glib/as-app.c +++ b/libappstream-glib/as-app.c @@ -2273,6 +2273,9 @@ as_app_set_id (AsApp *app, const gchar *id) ".shell-extension", NULL }; + g_return_if_fail (AS_IS_APP (app)); + g_return_if_fail (id != NULL); + /* handle untrusted */ if ((priv->trust_flags & AS_APP_TRUST_FLAG_CHECK_VALID_UTF8) > 0 && !as_app_validate_utf8 (id)) { @@ -4846,6 +4849,10 @@ as_app_node_parse_child (AsApp *app, GNode *n, guint32 flags, tmp = as_node_get_attribute (n, "type"); if (tmp != NULL) as_app_set_kind (app, as_app_kind_from_string (tmp)); + if (as_node_get_data (n) == NULL) { + priv->problems |= AS_APP_PROBLEM_EXPECTED_CHILDREN; + break; + } as_app_set_id (app, as_node_get_data (n)); break; |