[MPlayer-dev-eng] [PATCH] libass BorderStyle==3 fix

Evgeniy Stepanov eugeni.stepanov at gmail.com
Fri Jun 5 18:52:30 CEST 2009


On Friday 05 June 2009 19:12:48 Rinat wrote:
> > > Unfortunally this patch adding a bug. Sometimes, at mplayer closure it
> > > says something like
> > > *** glibc detected *** /usr/bin/mplayer: free(): invalid next size
> > > (normal)
> > >
> > > : 0x0a46f230 ***
> > >
> > > Can anyone help me fix this bug?
> >
> > Bad news, I can't reproduce it, the patch works fine for me. Try running
> > it under valgrind. Or send me a subtitle file it crashes on.
>
> attached file crashes patched mplayer in 2 seconds. Valgrind says something
> about invalid read.

Ok, I lied :) Clipping is needed here. For normal glyphs it is done in 
render_glyph().

>
> > > +	double outline; //outline width
> >
> > It's better to add "int border_style" instead. This way you will avoid
> > comparing floating point values for equality :)
>
> I've added 'outline' in same way as 'shadow' (already in code). It's double
> also, and compared to integer in 'render_text'.

Right. And it's bad style. Anyway, BorderStyle is orthogonal to outline width, 
and is not a property of an individual glyph. You can just check 
render_context.style->BorderStyle directly in render_text() for both outline 
and shadow bitmaps, or put it in text_info_t and check it from there. In this 
case you can also keep border and shadow calculation unchanged.

> > And please move that large chunk of code into a separate function, like
> > get_opaque_box(int width, int height).
>
> I'll fix it later. After preventing crash.




More information about the MPlayer-dev-eng mailing list