[gtk+] Avoid an out-of-bounds access
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Avoid an out-of-bounds access
- Date: Fri, 26 Feb 2016 20:53:14 +0000 (UTC)
commit ca3d87ce70e1a9c00a37d40eb0d8039d92368a1d
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Feb 26 15:50:31 2016 -0500
Avoid an out-of-bounds access
When the offset gets smaller than min_offset, we can't
access the array at that position.
gtk/gtktextiter.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index dc3891a..3e2e5f5 100644
--- a/gtk/gtktextiter.c
+++ b/gtk/gtktextiter.c
@@ -3073,9 +3073,12 @@ inside_sentence_func (const PangoLogAttr *attrs,
gint len)
{
/* Find next sentence start or end */
- while (offset >= min_offset &&
- !(attrs[offset].is_sentence_start || attrs[offset].is_sentence_end))
- --offset;
+ while (!(attrs[offset].is_sentence_start || attrs[offset].is_sentence_end))
+ {
+ --offset;
+ if (offset < min_offset)
+ return FALSE;
+ }
return attrs[offset].is_sentence_start;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]