From 46c9dfe2e7f2b8e2e1fb4a1ef0bb9de0bdd5a8b3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 29 Jan 2014 16:52:40 +0100 Subject: sd_lavc: skip 0 sized sub-bitmaps Not everything in the OSD path handles 0x0 sized sub-bitmaps well. At least the code implementing --sub-gray had severe problems with it. Fix this by skipping such bitmaps. --- sub/sd_lavc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index f0fa183419..9f57d9ec38 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -182,11 +182,13 @@ static void decode(struct sd *sd, struct demux_packet *packet) sub.num_rects); for (int i = 0; i < sub.num_rects; i++) { struct AVSubtitleRect *r = sub.rects[i]; - struct sub_bitmap *b = &priv->inbitmaps[i]; - struct osd_bmp_indexed *img = &priv->imgs[i]; + struct sub_bitmap *b = &priv->inbitmaps[priv->count]; + struct osd_bmp_indexed *img = &priv->imgs[priv->count]; if (!(r->flags & AV_SUBTITLE_FLAG_FORCED) && opts->forced_subs_only) continue; + if (r->w == 0 || r->h == 0) + continue; img->bitmap = r->pict.data[0]; assert(r->nb_colors > 0); assert(r->nb_colors * 4 <= sizeof(img->palette)); -- cgit v1.2.3