1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

38 Commits

Author SHA1 Message Date
Michael Niedermayer
249aca8f98 avcodec/movtextdec: Check style_start/end
Limits based on 3GPP TS 26.245 V14.0.0
Fixes: Timeout
Fixes: 6377/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOVTEXT_fuzzer-5175929115508736

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Philip Langdale <philipl@overt.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-09 03:09:08 +02:00
wm4
b0644c3e1a movtextdec: fix handling of UTF-8 subtitles
Subtitles which contained styled UTF-8 subtitles (i.e. not just 7 bit
ASCII characters) were not handled correctly. The spec mandates that
styling start/end ranges are in "characters". It's not quite clear what
a "character" is supposed to be, but maybe they mean unicode codepoints.

FFmpeg's decoder treated the style ranges as byte idexes, which could
lead to UTF-8 sequences being broken, and the common code dropping the
whole subtitle line.

Change this and count the codepoint instead. This also means that even
if this is somehow wrong, the decoder won't break UTF-8 sequences
anymore. The sample which led me to investigate this now appears to work
correctly.
2018-03-25 19:27:02 +02:00
Mark Thompson
e7d20d5e35 movtextdec: Move declaration out of for initialisation statement 2017-10-21 22:19:50 +01:00
Michael Niedermayer
bac9c03ed9 avcodec/movtextdec: run mov_text_cleanup() before overwriting pointers
Fixes: memleak
Fixes: 741/clusterfuzz-testcase-586996200452915

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-09 23:28:10 +01:00
Michael Niedermayer
a9f9b7f5c7 avcodec/movtextdec: Call mov_text_cleanup() on close
Fixes memleak
Fixes: 548/clusterfuzz-testcase-5511470875934720

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-06 16:47:17 +01:00
Michael Niedermayer
e248522d1b avcodec/movtextdec: Fix decode_styl() cleanup
Fixes: null pointer dereference
Fixes: 555/clusterfuzz-testcase-5986646595993600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-06 11:19:05 +01:00
Michael Niedermayer
0eb3198005 avcodec/movtextdec: Add error message for tsmb_size check
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-15 15:08:20 +01:00
Michael Niedermayer
a609905723 avcodec/movtextdec: Fix tsmb_size check==0 check
Fixes: 173/fuzz-3-ffmpeg_SUBTITLE_AV_CODEC_ID_MOV_TEXT_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-15 15:08:20 +01:00
Michael Niedermayer
6ea2715768 avcodec/movtextdec: Fix potential integer overflow
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-15 15:08:20 +01:00
Sasi Inguva
7e9e1b7070 lavc/movtextdec.c: Avoid infinite loop on invalid data.
Signed-off-by: Sasi Inguva <isasi@google.com>
2016-09-27 19:49:02 -07:00
Clément Bœsch
30e7685360 lavc/options: add ass_ro_flush_noop to flags2 2016-02-26 21:53:32 +01:00
Clément Bœsch
2941282124 lavc: allow subtitle text format to be ASS without timing 2016-02-26 21:49:34 +01:00
Clément Bœsch
6d32628bf3 lavc/ccaption_dec: improve default style
Use monospaced font, and a black box outline.
2016-01-10 16:28:14 +01:00
Michael Niedermayer
a047ccbb9f avcodec/movtextdec: Free ftab_temp
Fixes memleak
Fixes: efe937780e95574250dabe07151bdc23/unknown_unknown_351_849_cov_3187578556_shellymanne.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-31 23:44:39 +02:00
Michael Niedermayer
a1a32fdb0e avcodec/movtextdec: Make tx3g_ptr unsigned
Fixes integer overflow
Fixes: efe937780e95574250dabe07151bdc23/unknown_unknown_351_849_cov_3187578556_shellymanne.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-31 23:44:39 +02:00
Niklesh
a604289b85 movtextdec: Add support for automatic text wrapping
The value of wrap_flag in the Text Wrap Box specifies if the text is to
be wrapped or not. Uses 'end of line wrap' amongst the wrap styles
supported by ASS if the text is to be wrapped, i.e; fill as much text
in a line as possible, then break to next line.

The 3GPP spec has no provision for smart wrapping.

Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-08-14 19:35:26 -07:00
Niklesh
1bf8f54274 movtextdec: Use default style information from movtext header
As suggested, posting the combined patch with the fate changes.
The patch sets the default style in ASS from the default style
information present in the movtext header.

Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-08-12 14:43:19 -07:00
Michael Niedermayer
0eb896b38d Revert "movtextdec: Use default style information from movtext header"
The commit broke  sub-movtext and sub-subripenc
fate output differs between mips ad x86 so updating fate ref is not
possible

This reverts commit d670848d4c.
2015-08-10 02:09:14 +02:00
Niklesh
d670848d4c movtextdec: Use default style information from movtext header
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-08-09 15:12:15 -07:00
Niklesh
ecc806a224 movtextdec: Fix memory leaks by freeing mem allocs correctly
Initialize m->count_f to 0 at the correct place to free memory allocs properly.

Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-08-07 16:33:31 -07:00
Michael Niedermayer
ae413a48e6 avcodec/movtextdec: check that ftab has been allocated before dereferencing it
Fixes potential null pointer dereference on deallocation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-06 23:38:55 +02:00
Niklesh
2e7a684e72 movtextdec.c: Add support for font names
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-08-06 08:42:09 -07:00
Niklesh
f21fcf60ec movtextdec.c: Add support for fontsize
Add support for fontsize in style records. The patch uses reset to
directly change back to default style instead of using closing tags,
since we are not handling the default styles right now.

Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-07-26 09:35:20 -07:00
Niklesh
a927aacbe6 movtextdec.c: Correct the highlight tags
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-07-20 08:16:19 -07:00
Niklesh
774ceee17e movtextdec.c: Add support for highlight and hilightcolor box
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-07-12 10:24:17 -07:00
Niklesh
813b2f0da3 movtextdec.c: Improve upon dynarrays and text_to_ass
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-06-22 22:19:35 -07:00
Niklesh
9aabc926ca Improve upon dynamic arrays- movtext subtitles
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-05-25 11:39:29 -07:00
Niklesh
337aa17e61 avcodec/movtextdec: Add support for large boxes(>32 bit)
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-05-22 08:32:20 -07:00
Niklesh
b44a55ad2d Fix movtext crashes caused due to lack of proper bounds checking
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
2015-05-19 20:15:15 -07:00
Niklesh
0ec3abeb8d avcodec/movtextdec: Decoding of Bold-Italic_Underlined styles for 3gpp timed text subtitles
Signed-off-by: Niklesh <niklesh.lalwani@iitb.ac.in>
Previous version reviewed-by: Philip Langdale <philipl@overt.org>
Previous version reviewed-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-25 00:23:44 +02:00
Clément Bœsch
c669af0f24 avcodec/ass: add ASS trailing \r\n in one single place 2014-10-19 23:24:34 +02:00
Clément Bœsch
3d25869605 avcodec/ass: assume raw=0 in ff_ass_add_rect_bprint 2014-10-19 23:24:34 +02:00
Clément Bœsch
e833b02f2f avcodec/movtextdec: add some memory checks 2014-09-21 18:41:45 +02:00
Clément Bœsch
7d66bc7920 lavc/movtextdec: keep the min size instead of max to fix overread.
Fixes Ticket #2087.
2013-01-01 16:41:37 +01:00
Philip Langdale
569027ea80 movtextdec: Don't emit errors for normal duration-end packets.
The logic here was off. If the packet size is exactly two, then
it's a well-formed empty subtitle, used to mark the end of the
duration of the previous subtitle.

Signed-off-by: Philip Langdale <philipl@overt.org>
2012-08-15 22:03:16 -07:00
Michael Niedermayer
7a72695c05 Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'
* commit '36ef5369ee9b336febc2c270f8718cec4476cb85':
  Replace all CODEC_ID_* with AV_CODEC_ID_*
  lavc: add AV prefix to codec ids.

Conflicts:
	doc/APIchanges
	doc/examples/decoding_encoding.c
	doc/examples/muxing.c
	ffmpeg.c
	ffprobe.c
	ffserver.c
	libavcodec/8svx.c
	libavcodec/avcodec.h
	libavcodec/dnxhd_parser.c
	libavcodec/dvdsubdec.c
	libavcodec/error_resilience.c
	libavcodec/h263dec.c
	libavcodec/libvorbisenc.c
	libavcodec/mjpeg_parser.c
	libavcodec/mjpegenc.c
	libavcodec/mpeg12.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/pcm.c
	libavcodec/r210dec.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/version.h
	libavdevice/alsa-audio-dec.c
	libavdevice/bktr.c
	libavdevice/v4l2.c
	libavformat/asfdec.c
	libavformat/asfenc.c
	libavformat/avformat.h
	libavformat/avidec.c
	libavformat/caf.c
	libavformat/electronicarts.c
	libavformat/flacdec.c
	libavformat/flvdec.c
	libavformat/flvenc.c
	libavformat/framecrcenc.c
	libavformat/img2.c
	libavformat/img2dec.c
	libavformat/img2enc.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/matroska.c
	libavformat/matroskadec.c
	libavformat/matroskaenc.c
	libavformat/mov.c
	libavformat/movenc.c
	libavformat/mp3dec.c
	libavformat/mpeg.c
	libavformat/mpegts.c
	libavformat/mxf.c
	libavformat/mxfdec.c
	libavformat/mxfenc.c
	libavformat/nsvdec.c
	libavformat/nut.c
	libavformat/oggenc.c
	libavformat/pmpdec.c
	libavformat/rawdec.c
	libavformat/rawenc.c
	libavformat/riff.c
	libavformat/sdp.c
	libavformat/utils.c
	libavformat/vocenc.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-07 22:45:46 +02:00
Nicolas George
9009fa6de4 movtextdec: fix return value for too small packets. 2012-07-31 17:23:31 +02:00
Philip Langdale
2c501ae82b movtextdec: 3GPP TS 26.245 Timed Text Decoder.
This change introduces a basic decoder for 3GPP Timed Text subtitles,
also known as TX3G, Quicktime subtitles, or "movtext" in the existing
code.

This initial change doesn't attempt to parse styling information,
and just reads the plain text of the subtitles. I intend to add
support for styles eventually, but it's challenging due to a lack
of existing players that support them.

Signed-off-by: Philip Langdale <philipl@overt.org>
2012-07-14 14:50:02 -07:00