summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2020-10-19 13:38:10 +0300
committerOleg Oshmyan <chortos@inbox.lv>2020-10-19 20:36:18 +0300
commit30bd3d34d32cebeb7b1af6b9e77f617ef1d2bb9a (patch)
treea3f81aa569dbf85aab7c1f788bf9092019a66622 /libass
parentac7790c2bdf0440c40fa41995fe9112a767deb2a (diff)
downloadlibass-30bd3d34d32cebeb7b1af6b9e77f617ef1d2bb9a.tar.bz2
libass-30bd3d34d32cebeb7b1af6b9e77f617ef1d2bb9a.tar.xz
ass_shaper_find_runs: don't decrement pointer beyond array start
That triggers undefined behavior.
Diffstat (limited to 'libass')
-rw-r--r--libass/ass_shaper.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libass/ass_shaper.c b/libass/ass_shaper.c
index b608b17..19cafaf 100644
--- a/libass/ass_shaper.c
+++ b/libass/ass_shaper.c
@@ -785,19 +785,21 @@ void ass_shaper_find_runs(ASS_Shaper *shaper, ASS_Renderer *render_priv,
// find appropriate fonts for the shape runs
for (i = 0; i < len; i++) {
- GlyphInfo *last = glyphs + i - 1;
GlyphInfo *info = glyphs + i;
if (!info->drawing_text) {
// set size and get glyph index
ass_font_get_index(render_priv->fontselect, info->font,
info->symbol, &info->face_index, &info->glyph_index);
}
- if (i > 0 && (last->font != info->font ||
+ if (i > 0) {
+ GlyphInfo *last = glyphs + i - 1;
+ if ((last->font != info->font ||
last->face_index != info->face_index ||
last->script != info->script ||
info->starts_new_run ||
last->flags != info->flags))
- shape_run++;
+ shape_run++;
+ }
info->shape_run_id = shape_run;
}
}