diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c index 2765ceb759..78ce773822 100644 --- a/sub/draw_bmp.c +++ b/sub/draw_bmp.c @@ -283,6 +283,11 @@ static void mark_rect(struct mp_draw_sub_cache *p, int x0, int y0, int x1, int y } } + // Ensure the very last slice does not extend + // beyond the total width. + struct slice *last_s = &line[p->s_w - 1]; + last_s->x1 = MPMIN(p->w - ((p->s_w - 1) * SLICE_W), last_s->x1); + p->any_osd = true; } }