diff options
author | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-19 13:38:10 +0300 |
---|---|---|
committer | Oleg Oshmyan <chortos@inbox.lv> | 2020-10-19 20:36:18 +0300 |
commit | 30bd3d34d32cebeb7b1af6b9e77f617ef1d2bb9a (patch) | |
tree | a3f81aa569dbf85aab7c1f788bf9092019a66622 /libass | |
parent | ac7790c2bdf0440c40fa41995fe9112a767deb2a (diff) | |
download | libass-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.c | 8 |
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; } } |