[text] Ensure clutter_text_get_selection copes with start/end positions of -1
authorRobert Bragg <robert@linux.intel.com>
Wed, 13 May 2009 11:11:54 +0000 (12:11 +0100)
committerRobert Bragg <robert@linux.intel.com>
Wed, 13 May 2009 13:34:00 +0000 (14:34 +0100)
commit2b1759385e8f3373497b5d99c733266c2ecae1ee
tree19a597119afc19abb68a35fbbc849b19d7ecabdb
parent979f089ef9e5ef3486fd81f8ec4d38579bb7e7b7
[text] Ensure clutter_text_get_selection copes with start/end positions of -1

I was seeing clutter_text_get_selection trying to malloc up to 4Gb due to
unexpected negative arithmetic for the start/end offsets which resulted
in a crash.

This just tests for positions of -1 before deciding if the start/end
positions need to be swapped.  The conversion from position to byte offset
already works with -1.
clutter/clutter-text.c