summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-11-27 09:40:35 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-11-27 09:40:35 -0500
commit8f7c1ed695652df879417e748f09425e644a1d4d (patch)
treec54b8791034fb303aefef195955cbd5e38aeda83
parent2bd2a6b916f69c155c2a326c42922b65fe676643 (diff)
downloadpango-8f7c1ed695652df879417e748f09425e644a1d4d.tar.gz
Avoid an out-of-bound access
We can only use the width of the previous char if we are not at the first char. Found by asan.
-rw-r--r--pango/pango-layout.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index 703f4573..40e24cbb 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -3750,7 +3750,7 @@ find_break_extra_width (PangoLayout *layout,
{
ensure_hyphen_width (state);
- if (layout->log_attrs[state->start_offset + pos].break_removes_preceding)
+ if (layout->log_attrs[state->start_offset + pos].break_removes_preceding && pos > 0)
return state->hyphen_width - state->log_widths[state->log_widths_offset + pos - 1];
else
return state->hyphen_width;