[FFmpeg-devel] [PATCH] lavc/srtdec: handle leading whitespace before tag names
Rodger Combs
rodger.combs at gmail.com
Wed Jul 15 02:10:22 CEST 2015
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)) ||
--
2.4.1
More information about the ffmpeg-devel
mailing list