Limin Wang
157873623f
avcodec/dvbsubdec: replace data_size with got_sub_ptr for better readability
...
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
5 years ago
Michael Niedermayer
5941b7f615
avcodec/dvbsubdec: Use ff_set_dimensions()
...
Fixes: signed integer overflow: 65313 * 65313 cannot be represented in type 'int'
Fixes: 15740/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-5641749164195840
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Michael Niedermayer
a8c5ae4511
avcodec/dvbsubdec: Check object position
...
Reference: ETSI EN 300 743 V1.2.1 7.2.2 Region composition segment
Fixes: Timeout
Fixes: 13325/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-5143979392237568
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 years ago
Michael Niedermayer
71ba79702d
avcodec/dvbsubdec: Compute scoretab without iterating over pixels multiple times in compute_default_clut()
...
Improves speed 102->2 sec
Testcase: 8655/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DVBSUB_fuzzer-6277869285146624
Fixes: Timeout
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years ago
Michael Niedermayer
eec67f7b24
avcodec/dvbsubdec: Avoid re-computing clut
...
Fixes: Timeout
Fixes: 3218/clusterfuzz-testcase-5390672154591232
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years ago
Michael Niedermayer
963247b5f3
avcodec/dvbsubdec: Split best score computation out of loop in compute_default_clut()
...
3% faster
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years ago
Michael Niedermayer
cd2f69cdd6
avcodec/dvbsubdec: Factor a few expressions out of compute_default_clut()
...
32% faster loop
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years ago
Michael Niedermayer
7c10068da1
avcodec/dvbsubdec: Check for duplicate regions in dvbsub_parse_page_segment()
...
Fixes: OOM
Fixes: 3051/clusterfuzz-testcase-minimized-5745818336231424
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years ago
Vittorio Giovara
a594f17f83
dvbsubdec: Free subrect memory on allocation error
...
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
8 years ago
Lorenz Brun
1cfd566324
dvbsubdec: Fixed segfault when decoding subtitles
...
This fixes a segfault (originally found in Movian, but traced to libav)
when decoding subtitles because only an array of rects is allocated,
but not the actual structs it contains. The issue was probably
introduced in commit 2383323
where the loop to allocate the rects in
the array was thrown away.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
8 years ago
Michael Niedermayer
e1b0044c23
avcodec/dvbsubdec: Check pixel buffer size constraint from ETSI EN 300 743 V1.3.1
...
Fixes: OOM
Fixes: 2143/clusterfuzz-testcase-minimized-5482288060039168
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Michael Niedermayer
4bcde26172
avcodec/dvbsubdec: Use av_image_check_size2()
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Michael Niedermayer
8a69f2602f
avcodec/dvbsubdec: Check entry_id
...
Fixes: randomly writing over the array end
Fixes: 1473/clusterfuzz-testcase-minimized-5768907824562176
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Michael Niedermayer
0075d9eced
avcodec/dvbsubdec: check region dimensions
...
Fixes: 1408/clusterfuzz-testcase-minimized-6529985844084736
Fixes: integer overflow
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Michael Niedermayer
b02027c79d
avcodec/dvbsubdec: Replace fprintf(stderr) by av_log()
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Diego Biurrun
a25dac976a
Use bitstream_init8() where appropriate
8 years ago
Alexandra Hájková
9aec009f65
dvbsubdec: Convert to the new bitstream reader
8 years ago
Diego Biurrun
b34c6cd57a
dvbsub: cosmetics: Group all debug code together
8 years ago
Diego Biurrun
b8cd7a3c8d
dvbsub: Check for errors from system()
...
libavcodec/dvbsubdec.c:145:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
libavcodec/dvbsubdec.c:148:5: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result [-Wunused-result]
8 years ago
Andreas Cadhalpun
c82b8ef0e4
dvbsubdec: fix division by zero in compute_default_clut
...
This problem was introduced in commit
4b90dcb849
.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
8 years ago
Diego Biurrun
7effebde78
dvbsubdec: Remove disabled, near-duplicate debug code
8 years ago
Diego Biurrun
e723dce6f8
dvbsubdec: Use NULL instead of 0 as pointer value
9 years ago
Diego Biurrun
b7e64fba7f
Reduce the scope of some variables
...
This avoids unused variable warnings after the next version bump.
Also drop a trace level av_log() call that is in the way.
9 years ago
Clément Bœsch
fb99ef0bd3
avcodec: use AV_OPT_TYPE_BOOL in a bunch of places
9 years ago
Vittorio Giovara
a17a766190
lavc: Add data and linesize to AVSubtitleRect
...
Use the new fields directly instead of the ones from AVPicture.
This removes a layer of indirection which serves no pratical purpose
whatsoever, and will help in removing AVPicture structure completely
later.
Every subtitle encoder/decoder seamlessly points to the new arrays,
so it is possible to deprecate AVSubtitleRect.pict.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
9 years ago
Vittorio Giovara
1da2a20763
dvbsubdec: Fix function return type
9 years ago
Ronald S. Bultje
6471040f56
FF_OPT_TYPE_* -> AV_OPT_TYPE_*.
10 years ago
Michael Niedermayer
d21ab8e411
avcodec/dvbsubdec: Print field lens in case they are too lerge
...
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 years ago
Carl Eugen Hoyos
daf2c35f52
lavc: Remove newline from avpriv_request_sample() calls.
10 years ago
Michael Niedermayer
e5774f28d1
avcodec/dvbsubdec: Do not stop decoding at a invalid depth
...
This corrects parsing the later elements
Fixes Ticket4754
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 years ago
Carl Eugen Hoyos
087c0a0a93
lavc/dvbsub: Do not fail on clut depth 0.
...
Fixes ticket #4752 .
10 years ago
Michael Niedermayer
3f87a17063
avcodec/dvbsubdec: Allow selecting the substream, or all substreams
...
Fixes Ticket 2161
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 years ago
Michael Niedermayer
1fc20af6af
avcodec/dvbsubdec: Implement display definition segment fallback from ETSI EN 300 743 V1.3.1
...
Fixes: subtitles.ts
Fixes: Ticket679
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 years ago
Michael Niedermayer
d41dceb14e
avcodec/dvbsubdec: Add option to select when to computer clut (always/never/"if needed")
...
Reviewed-by: Anshul <anshul.ffmpeg@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 years ago
Michael Niedermayer
4b90dcb849
avcodec/dvbsubdec: Compute default CLUT based on bitmap analysis
...
Fixes displaying subtitles before any CLUT has been received
Fixes Ticket153
This will of course not display these initial subtitles in the correct
color (as that is not known at that point) but they should look clean
and not corrupted
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
10 years ago
banastasov
debf4d6e67
avcodec/dvbsubdec: Fix buf_size check in dvbsub_parse_display_definition_segment()
...
Fixes Ticket4326
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
9f0b898e82
avcodec/dvbsubdec: Clear w/h/size on region buffer allocation failure
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
e06dde52d7
avcodec/dvbsubdec: Do not return a value from a function returning void
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Vittorio Giovara
6a85dfc830
lavc: Replace av_dlog and tprintf with internal macros
10 years ago
Vittorio Giovara
607ad990d3
dvbsubdec: check memory allocations and propagate errors
10 years ago
Michael Niedermayer
8de0990e9f
avcodec/dvbsubdec: Check get_region() return value
...
Fixes null pointer dereference with DEBUG enabled
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
1bf747ae84
avcodec/dvbsubdec: Return proper error codes from more functions
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
ebe3a41ea3
avcodec/dvbsubdec: Add some av_malloc() failure checks
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
ce800d4695
avcodec/dvbsubdec: Remove redundant "DVBSub error" prefix
...
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
4ba0141921
avcodec/dvbsubdec: Pass context to av_log()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
d03867c248
avcodec/dvbsubdec: av_assert* instead of assert()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
39dfe6801a
avcodec/dvbsubdec: Cleanup on *malloc failure
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
e0c36f5825
avcodec/dvbsubdec: Fix 8bit non_mod case
...
Untested, i failed to find a sample which triggers this case
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
2813dabdd4
avcodec/dvbsubdec: use av_freep() for saftey
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
6229f7823e
avcodec/dvbsubdec: Add return code to save_subtitle_set()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago