mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
[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.
This commit is contained in:
parent
979f089ef9
commit
2b1759385e
@ -2859,7 +2859,8 @@ clutter_text_get_selection (ClutterText *self)
|
|||||||
if (end_index == start_index)
|
if (end_index == start_index)
|
||||||
return g_strdup ("");
|
return g_strdup ("");
|
||||||
|
|
||||||
if (end_index < start_index)
|
if ((end_index != -1 && end_index < start_index) ||
|
||||||
|
start_index == -1)
|
||||||
{
|
{
|
||||||
gint temp = start_index;
|
gint temp = start_index;
|
||||||
start_index = end_index;
|
start_index = end_index;
|
||||||
|
Loading…
Reference in New Issue
Block a user