summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-11-08 00:07:09 +0000
committerTor Lillqvist <tml@src.gnome.org>2006-11-08 00:07:09 +0000
commit4e2964214ed1fe93823cf2c9e07b721b57590663 (patch)
tree3b4cdf01923afc21f78ae86c31b309e57d78be27
parent10b4737f9d0b0151414456eb1a063c242d592f12 (diff)
downloadpango-4e2964214ed1fe93823cf2c9e07b721b57590663.tar.gz
Bug 369670 – Crash when selecting text using the keyboard
2006-11-08 Behdad Esfahbod <behdad@gnome.org> Bug 369670 – Crash when selecting text using the keyboard * pango/pango-layout.c (pango_layout_move_cursor_visually): Don't index vis2log_map[] with a negative value.
-rw-r--r--ChangeLog7
-rw-r--r--pango/pango-layout.c7
2 files changed, 11 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 346e23cf..90cfd547 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-08 Behdad Esfahbod <behdad@gnome.org>
+
+ Bug 369670 – Crash when selecting text using the keyboard
+
+ * pango/pango-layout.c (pango_layout_move_cursor_visually): Don't
+ index vis2log_map[] with a negative value.
+
2006-11-02 Behdad Esfahbod <behdad@gnome.org>
Bug 369670 – Checked g_free calls
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 323b1371..cd64af03 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -1370,7 +1370,7 @@ pango_layout_move_cursor_visually (PangoLayout *layout,
int *log2vis_map;
int *vis2log_map;
int n_vis;
- int vis_pos, log_pos;
+ int vis_pos, vis_pos_old, log_pos;
int start_offset;
gboolean off_start = FALSE;
gboolean off_end = FALSE;
@@ -1470,14 +1470,15 @@ pango_layout_move_cursor_visually (PangoLayout *layout,
vis2log_map = pango_layout_line_get_vis2log_map (line, strong);
+ vis_pos_old = vis_pos + direction;
log_pos = g_utf8_pointer_to_offset (layout->text + line->start_index,
- layout->text + line->start_index + vis2log_map[vis_pos]);
+ layout->text + line->start_index + vis2log_map[vis_pos_old]);
do
{
- int vis_pos_old = vis_pos;
vis_pos += direction;
log_pos += g_utf8_pointer_to_offset (layout->text + line->start_index + vis2log_map[vis_pos_old],
layout->text + line->start_index + vis2log_map[vis_pos]);
+ vis_pos_old = vis_pos;
}
while (vis_pos > 0 && vis_pos < n_vis &&
!layout->log_attrs[start_offset + log_pos].is_cursor_position);