openbsd-ports/devel/json-glib/patches/patch-json-glib_json-gobject_c
jasper 3ac252df74 import json-glib 0.6.2
JSON-GLib implements a full JSON parser using GLib and GObject.
Use JSON-GLib it is possible to parse and generate valid JSON data
structures, using a DOM-like API. JSON-GLib also offers GObject
integration, providing the ability to serialize and deserialize GObject
instances to and from JSON data types.
2009-01-05 18:11:06 +00:00

26 lines
1.0 KiB
Plaintext

$OpenBSD: patch-json-glib_json-gobject_c,v 1.1.1.1 2009/01/05 18:11:06 jasper Exp $
Fix an array overflow which led to an assertion crash.
From: http://bugzilla.openedhand.com/show_bug.cgi?id=1203
--- json-glib/json-gobject.c.orig Mon Jan 5 17:25:46 2009
+++ json-glib/json-gobject.c Mon Jan 5 17:26:39 2009
@@ -189,7 +189,7 @@ json_deserialize_pspec (GValue *value,
{
JsonArray *array = json_node_get_array (node);
guint i, array_len = json_array_get_length (array);
- GPtrArray *str_array = g_ptr_array_sized_new (array_len);
+ GPtrArray *str_array = g_ptr_array_sized_new (array_len + 1);
for (i = 0; i < array_len; i++)
{
@@ -201,6 +201,8 @@ json_deserialize_pspec (GValue *value,
if (json_node_get_string (val) != NULL);
g_ptr_array_add (str_array, (gpointer) json_node_get_string (val));
}
+
+ g_ptr_array_add (str_array, NULL);
g_value_set_boxed (value, str_array->pdata);