summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gorse <mgorse@novell.com>2011-12-04 12:51:39 -0600
committerMike Gorse <mgorse@novell.com>2011-12-22 10:37:33 -0500
commit867d3f7debdd35738701156969f24544c4b6c5ce (patch)
treeca9b0213211d54f934fafa2f2a0e9ff9e77f00dc
parentebd85e5f03457adaa0c0310448d92f6639c52332 (diff)
downloadatk-867d3f7debdd35738701156969f24544c4b6c5ce.tar.gz
BGO#665549: add sanity-check of atk_text_get_text parameters
Have atk_text_get_text check that end_offset is either -1 or greater or equal to the start offset before passing the query to the toolkit. Fixes a gtk crash. Also document that an end position of -1 to atk_text_get_text indicates the end of the string
-rwxr-xr-xatk/atktext.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/atk/atktext.c b/atk/atktext.c
index a1e90de..086dd18 100755
--- a/atk/atktext.c
+++ b/atk/atktext.c
@@ -237,7 +237,7 @@ atk_text_base_init (AtkTextIface *class)
* atk_text_get_text:
* @text: an #AtkText
* @start_offset: start position
- * @end_offset: end position
+ * @end_offset: end position, or -1 for the end of the string.
*
* Gets the specified text.
*
@@ -255,7 +255,8 @@ atk_text_get_text (AtkText *text,
iface = ATK_TEXT_GET_IFACE (text);
- if (start_offset < 0 || end_offset < -1)
+ if (start_offset < 0 || end_offset < -1 ||
+ (end_offset != -1 && end_offset < start_offset))
return NULL;
if (iface->get_text)