[glib/glib-2-28] g_variant_get_child_value: Add a precondition on length
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-28] g_variant_get_child_value: Add a precondition on length
- Date: Sun, 5 Jun 2011 17:41:37 +0000 (UTC)
commit a62eb4237edb110fbab72fcb4ed734c9e6a67b10
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Fri May 27 16:03:04 2011 -0400
g_variant_get_child_value: Add a precondition on length
Ensure callers get a warning if they pass a bad length.
Split into a separate commit and changed to order index before
n_children by Colin Walters <walters verbum org>
glib/gvariant-core.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/glib/gvariant-core.c b/glib/gvariant-core.c
index 6b27266..d2bd576 100644
--- a/glib/gvariant-core.c
+++ b/glib/gvariant-core.c
@@ -848,6 +848,8 @@ GVariant *
g_variant_get_child_value (GVariant *value,
gsize index_)
{
+ g_return_val_if_fail (index_ < g_variant_n_children (value), NULL);
+
if (~g_atomic_int_get (&value->state) & STATE_SERIALISED)
{
g_variant_lock (value);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]