mirror of
				https://gitlab.gnome.org/GNOME/glib.git
				synced 2025-10-31 08:22:16 +01:00 
			
		
		
		
	GVariant parser: turn two asserts into soft errors
Parsing wrongly-typed GVariant text format data is a well-defined operation and it ought to result in a GError. We do that for most cases, but 'v' and 'ay' were being treated differently. Fix those as well.
This commit is contained in:
		| @@ -1142,7 +1142,9 @@ variant_get_value (AST                 *ast, | ||||
|   Variant *variant = (Variant *) ast; | ||||
|   GVariant *child; | ||||
|  | ||||
|   g_assert (g_variant_type_equal (type, G_VARIANT_TYPE_VARIANT)); | ||||
|   if (!g_variant_type_equal (type, G_VARIANT_TYPE_VARIANT)) | ||||
|     return ast_type_error (ast, type, error); | ||||
|  | ||||
|   child = ast_resolve (variant->value, error); | ||||
|  | ||||
|   if (child == NULL) | ||||
| @@ -1656,7 +1658,8 @@ bytestring_get_value (AST                 *ast, | ||||
| { | ||||
|   ByteString *string = (ByteString *) ast; | ||||
|  | ||||
|   g_assert (g_variant_type_equal (type, G_VARIANT_TYPE_BYTESTRING)); | ||||
|   if (!g_variant_type_equal (type, G_VARIANT_TYPE_BYTESTRING)) | ||||
|     return ast_type_error (ast, type, error); | ||||
|  | ||||
|   return g_variant_new_bytestring (string->string); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user