summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2011-03-24 12:16:07 +0100
committerCarlos Garcia Campos <carlosgc@gnome.org>2011-03-24 12:17:54 +0100
commit73b39e25161fb0d20896af366ca9661bdaea4dc7 (patch)
tree6acaa1de6e7b64f5874f4b09651281ecd47cd0a3
parent6d1ddd071ad7d361903778dd5eb01defeafc33eb (diff)
glib: Add g_return macros to make sure index is correct in form field choice methods
-rw-r--r--glib/poppler-form-field.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/glib/poppler-form-field.cc b/glib/poppler-form-field.cc
index 9d4ffbb8..55d3bb31 100644
--- a/glib/poppler-form-field.cc
+++ b/glib/poppler-form-field.cc
@@ -540,6 +540,7 @@ poppler_form_field_choice_get_item (PopplerFormField *field,
GooString *tmp;
g_return_val_if_fail (field->widget->getType () == formChoice, NULL);
+ g_return_val_if_fail (index >= 0 && index < poppler_form_field_choice_get_n_items (field), NULL);
tmp = static_cast<FormWidgetChoice*>(field->widget)->getChoice (index);
return tmp ? _poppler_goo_string_to_utf8 (tmp) : NULL;
@@ -559,6 +560,7 @@ poppler_form_field_choice_is_item_selected (PopplerFormField *field,
gint index)
{
g_return_val_if_fail (field->widget->getType () == formChoice, FALSE);
+ g_return_val_if_fail (index >= 0 && index < poppler_form_field_choice_get_n_items (field), FALSE);
return static_cast<FormWidgetChoice*>(field->widget)->isSelected (index);
}
@@ -575,6 +577,7 @@ poppler_form_field_choice_select_item (PopplerFormField *field,
gint index)
{
g_return_if_fail (field->widget->getType () == formChoice);
+ g_return_if_fail (index >= 0 && index < poppler_form_field_choice_get_n_items (field));
static_cast<FormWidgetChoice*>(field->widget)->select (index);
}
@@ -605,6 +608,7 @@ poppler_form_field_choice_toggle_item (PopplerFormField *field,
gint index)
{
g_return_if_fail (field->widget->getType () == formChoice);
+ g_return_if_fail (index >= 0 && index < poppler_form_field_choice_get_n_items (field));
static_cast<FormWidgetChoice*>(field->widget)->toggle (index);
}