From: Padraig O'Briain Date: Wed, 20 Feb 2002 17:18:01 +0000 (+0000) Subject: Add check for offset being negative in functins which have offset X-Git-Tag: ATK_0_13~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e1695d4f2936c97e935ef5c8ef911db731077558;p=platform%2Fupstream%2Fatk.git Add check for offset being negative in functins which have offset * atk/atktext.c: Add check for offset being negative in functins which have offset parameter and return immediately if so. --- diff --git a/ChangeLog b/ChangeLog index 253c6cc..65d5b15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-02-20 Padraig O'Briain + + * atk/atktext.c: + Add check for offset being negative in functions which have offset + parameter and return immediately if so. + 2002-02-15 Padraig O'Briain * atk/atkcomponent.h: diff --git a/atk/atktext.c b/atk/atktext.c index ff811bb..4d8378c 100755 --- a/atk/atktext.c +++ b/atk/atktext.c @@ -157,6 +157,9 @@ atk_text_get_text (AtkText *text, iface = ATK_TEXT_GET_IFACE (text); + if (start_offset < 0 || end_offset < 0) + return NULL; + if (iface->get_text) return (*(iface->get_text)) (text, start_offset, end_offset); else @@ -180,6 +183,9 @@ atk_text_get_character_at_offset (AtkText *text, g_return_val_if_fail (ATK_IS_TEXT (text), (gunichar) 0); + if (offset < 0) + return (gunichar) 0; + iface = ATK_TEXT_GET_IFACE (text); if (iface->get_character_at_offset) @@ -258,6 +264,9 @@ atk_text_get_text_after_offset (AtkText *text, else real_end_offset = &local_end_offset; + if (offset < 0) + return NULL; + iface = ATK_TEXT_GET_IFACE (text); if (iface->get_text_after_offset) @@ -343,6 +352,9 @@ atk_text_get_text_at_offset (AtkText *text, else real_end_offset = &local_end_offset; + if (offset < 0) + return NULL; + iface = ATK_TEXT_GET_IFACE (text); if (iface->get_text_at_offset) @@ -426,6 +438,9 @@ atk_text_get_text_before_offset (AtkText *text, else real_end_offset = &local_end_offset; + if (offset < 0) + return NULL; + iface = ATK_TEXT_GET_IFACE (text); if (iface->get_text_before_offset) @@ -502,17 +517,18 @@ atk_text_get_character_extents (AtkText *text, else real_height = &local_height; + *real_x = 0; + *real_y = 0; + *real_width = 0; + *real_height = 0; + + if (offset < 0) + return; + iface = ATK_TEXT_GET_IFACE (text); if (iface->get_character_extents) (*(iface->get_character_extents)) (text, offset, real_x, real_y, real_width, real_height, coords); - else - { - *real_x = 0; - *real_y = 0; - *real_width = 0; - *real_height = 0; - } } /** @@ -553,6 +569,9 @@ atk_text_get_run_attributes (AtkText *text, else real_end_offset = &local_end_offset; + if (offset < 0) + return NULL; + iface = ATK_TEXT_GET_IFACE (text); if (iface->get_run_attributes)