This fixes a bunch of possible overread in avformat with the idiom p +=
strcspn(p, "\n") + 1 (strcspn() can focus on the trailing '\0' if no
'\n' is found, so the +1 leads to an overread).
Note on lavf/matroskaenc: no extra subtitles.o Makefile dependency is
added because only the header is required for ff_subtitles_next_line().
Note on lavf/mpsubdec: code gets slightly complex to avoid an infinite
loop in the probing since there is no more forced increment.
This fixes use of uninitialized memory and possible out of array access
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The muxer add them automatically, so this avoid having a bunch of line
breaks all over the output files. One '\n' is still kept/added because
the lavc subrip decoder seems to have trouble with line ending abruptly
(it doesn't flush correctly the tags). This bug is harmless but should
be fixed; though, this doesn't look like a trivial change. When this bug
gets fixed, we can consider removing the '\n' at the end of the packet.
The 2048B buffer limit was also removed while moving to AVBPrint API.
Note that this doesn't really matter since the decoder is limited as
well.
The SRT format should never have outputted CODEC_ID_SRT packets in the
first place: SRT is a subtitle format containing SubRip text markup
events. The timing information is part of the format, not the codec, and
thus CODEC_ID_SRT should not exist.
Creating packets with the timing information within the payload only
leads to problem (such as remuxing with timing alteration not working),
especially when the SubRip markup is being used in container like
Matroska in addition to this standalone SRT format.
The main reason the timing line was included in those CODEC_ID_SRT
packets is likely because it contained extra information (the event
position) the codec actually needs. This issue is solved by using the
AV_PKT_DATA_SUBTITLE_POSITION side data type.
The current demuxer does not bother to write packet durations,
which makes it impossible to remux into a new format.
Signed-off-by: Philip Langdale <philipl@overt.org>
This also lists the objects from those two libraries as internal (by adding
the ff_ prefix) so that they can then be hidden via linker scripts.
(cherry picked from commit c6610a216e)