[FFmpeg-devel] [PATCH] lavc/srtdec: handle leading whitespace before tag names
Michael Niedermayer
michael at niedermayer.cc
Wed Jul 15 15:49:35 CEST 2015
On Wed, Jul 15, 2015 at 02:44:02PM +0200, wm4 wrote:
> On Tue, 14 Jul 2015 19:10:22 -0500
> Rodger Combs <rodger.combs at gmail.com> wrote:
>
> > This fixes cases like `</ font>`.
> >
> > I'm not particularly happy with this solution, but anything better would need
> > to be part of a larger cleanup.
> > ---
> > libavcodec/srtdec.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c
> > index ed3af95..0d1b80e 100644
> > --- a/libavcodec/srtdec.c
> > +++ b/libavcodec/srtdec.c
> > @@ -114,7 +114,9 @@ static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst,
> > case '<':
> > tag_close = in[1] == '/';
> > len = 0;
> > - if (sscanf(in+tag_close+1, "%127[^>]>%n", buffer, &len) >= 1 && len > 0) {
> > + while (*(in + 1 + tag_close) == ' ')
> > + in++;
> > + if (sscanf(in + 1 + tag_close, "%127[^>]>%n", buffer, &len) >= 1 && len > 0) {
> > if ((param = strchr(buffer, ' ')))
> > *param++ = 0;
> > if ((!tag_close && sptr < FF_ARRAY_ELEMS(stack)) ||
>
> If the in variable can be changed without anything breaking, this looks
> ok.
looking at it, i suspect the unknown = 1 case might "break" or rather
not work correctly with this
Rodger, is that an issue ? can it be fixed?
if its not trivial to fix then please resubmit a patch which adds a
comment in the code about that issue so its not forgotten
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150715/9393b285/attachment.sig>
More information about the ffmpeg-devel
mailing list