1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00
Commit Graph

16 Commits

Author SHA1 Message Date
James Almer
cae2f1db10 avcodec/htmlsubtitles: fix format specifier in av_bprintf calls 2017-08-03 17:51:51 -03:00
Clément Bœsch
1193301758 lavc/htmlsubtitles: reindent after previous commits 2017-08-01 15:50:00 +02:00
Clément Bœsch
479ab8c3f8 lavc/htmlsubtitles: handle colors starting with many '#' 2017-08-01 15:50:00 +02:00
Clément Bœsch
e800371863 lavc/htmlsubtitles: improve line breaks handling 2017-08-01 15:50:00 +02:00
Clément Bœsch
f0f8da545d lavc/htmlsubtitles: improve handling broken garbage
This commit switches off forced correct nesting of tags and only keeps
it for font tags. See long explanations in the code for the rationale.

This results in various FATE changes which I'll explain here:

- various swapping in font attributes, this is mostly noise due to the
  old reverse stack way of printing them. The new one is more correct as
  the last attribute takes over the previous ones.

- unrecognized tags disappears

- invalid tags that were previously displayed aren't anymore (instead,
  we have a warning). This is better for the end user

The main benefit of this commit is to be more tolerant to error, leading
to a better handling of badly nested tags or random wrong formatting for
the end user.
2017-08-01 15:50:00 +02:00
Clément Bœsch
2ba20d799a lavc/htmlsubtitles: simplify 1-char tags case insensitive test 2017-07-26 19:56:28 +02:00
Michael Niedermayer
c61715e2c5 avcodec/htmlsubtitles: Be a bit more picky on syntax
This reduces the number of strstr() calls per byte
This diasalows empty tags like '< >' as well as '<' in tags like '<ab<cd<<ef>'

Fixes timeout
Fixes: 1817/clusterfuzz-testcase-minimized-5104230530547712

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-18 22:14:16 +02:00
DongHoon Kang
db8f615d68 libavcodec/htmlsubtitles.c: make tags case-insensitive
Signed-off-by: DongHoon Kang <nanuda.kang@gmail.com>
Signed-off-by: Clément Bœsch <u@pkh.me>
2017-07-07 12:01:00 +02:00
wm4
f605b56ad9 htmlsubtitles: support <br> tag
Some .srt files use this tag.

(An alternative implementation would be correctly ignoring unknown tags,
and treating them as whitespace. libass can do automatic line wrapping.)
2017-07-06 10:04:55 +02:00
Michael Niedermayer
14b834c45a avcodec/htmlsubtitles: Factor open brace handling into its own function
Suggested-by: wm4
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-18 14:50:35 +02:00
Michael Niedermayer
4132218b87 avcodec/htmlsubtitles: Replace very slow redundant sscanf() calls by cleaner and faster code
This reduces the worst case from O(n²) to O(n) time

Fixes Timeout
Fixes: 2127/clusterfuzz-testcase-minimized-6595787859427328

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-18 14:50:30 +02:00
Michael Niedermayer
f4ae3cce64 avcodec/htmlsubtitles: Check for string truncation and return error
Fixes out of array access
Fixes: 1354/clusterfuzz-testcase-minimized-5520132195483648

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-08 17:02:02 +02:00
Michael Niedermayer
04bd1b38ee avcodec/htmlsubtitles: Fix reading one byte beyond the array
Fixes: fuzz-2-ffmpeg_SUBTITLE_AV_CODEC_ID_SUBRIP_fuzzer

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-12 03:23:03 +01:00
Rodger Combs
d2d020bb32 avcodec/htmlsubtitles: handle leading whitespace before tag names
This fixes cases like `</ font>`.

Signed-off-by: Clément Bœsch <u@pkh.me>
2015-09-06 15:48:34 +02:00
Clément Bœsch
26786f43d7 avcodec/htmlsubtitles: drop avcodec dependency 2015-09-06 13:39:04 +02:00
Yayoi
50332f8a6b avcodec/srtdec: factor out HTML parsing code
This code will be used in SAMI decoder in a later commit.

Signed-off-by: Clément Bœsch <u@pkh.me>
2015-09-06 13:07:44 +02:00