Avoid an out-of-bounds access

When the offset gets smaller than min_offset, we can't
access the array at that position.
This commit is contained in:
Matthias Clasen 2016-02-26 15:50:31 -05:00
parent 8ff40b5d14
commit ca3d87ce70

View File

@ -3073,9 +3073,12 @@ inside_sentence_func (const PangoLogAttr *attrs,
gint len) gint len)
{ {
/* Find next sentence start or end */ /* Find next sentence start or end */
while (offset >= min_offset && while (!(attrs[offset].is_sentence_start || attrs[offset].is_sentence_end))
!(attrs[offset].is_sentence_start || attrs[offset].is_sentence_end)) {
--offset; --offset;
if (offset < min_offset)
return FALSE;
}
return attrs[offset].is_sentence_start; return attrs[offset].is_sentence_start;
} }