Commit Graph

171 Commits

Author SHA1 Message Date
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>
2017-11-15 17:31:09 +01:00
James Almer 7d1c79f533 Merge commit 'a594f17f83a1ffdc1eec18818208fe39487dd5d7'
* commit 'a594f17f83a1ffdc1eec18818208fe39487dd5d7':
  dvbsubdec: Free subrect memory on allocation error
  dvbsubdec: Fixed segfault when decoding subtitles

See
fbb59a3bf4
39dfe6801a

Merged-by: James Almer <jamrial@gmail.com>
2017-11-06 18:46:05 -03:00
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>
2017-10-14 23:23:25 +02:00
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>
2017-10-14 23:23:25 +02:00
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>
2017-08-25 23:38:24 +02:00
Vittorio Giovara a594f17f83 dvbsubdec: Free subrect memory on allocation error
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2017-06-28 09:44:09 -04:00
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>
2017-06-28 09:44:09 -04:00
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>
2017-06-10 00:48:07 +02:00
Michael Niedermayer 4bcde26172 avcodec/dvbsubdec: Use av_image_check_size2()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-06-10 00:48:07 +02:00
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>
2017-05-11 15:51:08 +02:00
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>
2017-05-08 15:28:26 +02:00
Michael Niedermayer b02027c79d avcodec/dvbsubdec: Replace fprintf(stderr) by av_log()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-05 23:57:08 +02:00
Clément Bœsch 7650bccdb1 Merge commit 'b34c6cd57a2e8aad5f773aea933f77883de320ec'
* commit 'b34c6cd57a2e8aad5f773aea933f77883de320ec':
  dvbsub: cosmetics: Group all debug code together

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-03 21:02:54 +02:00
Clément Bœsch 9f7ba0ac9d Merge commit 'b8cd7a3c8df2c3aac8d7a0b5a02d83caf61bd769'
* commit 'b8cd7a3c8df2c3aac8d7a0b5a02d83caf61bd769':
  dvbsub: Check for errors from system()

printf(...) replaced with fprintf(stderr, ...) for logging errors.

Merged-by: Clément Bœsch <u@pkh.me>
2017-04-03 21:01:40 +02:00
Clément Bœsch ff66ba6feb Merge commit '7effebde78977fafce935776153ea2f7c0981fa3'
* commit '7effebde78977fafce935776153ea2f7c0981fa3':
  dvbsubdec: Remove disabled, near-duplicate debug code

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-19 16:10:17 +01:00
Diego Biurrun a25dac976a Use bitstream_init8() where appropriate 2017-02-07 18:27:21 +01:00
Alexandra Hájková 9aec009f65 dvbsubdec: Convert to the new bitstream reader 2017-01-09 15:21:47 +01:00
Diego Biurrun b34c6cd57a dvbsub: cosmetics: Group all debug code together 2016-11-23 07:40:46 +01:00
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]
2016-11-23 07:36:32 +01:00
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>
2016-11-10 21:01:59 +01:00
Diego Biurrun 7effebde78 dvbsubdec: Remove disabled, near-duplicate debug code 2016-08-17 12:16:42 +02:00
Diego Biurrun e723dce6f8 dvbsubdec: Use NULL instead of 0 as pointer value 2016-08-03 08:26:40 +02:00
Clément Bœsch a4403e49b9 Merge commit 'b7e64fba7f37cc0399beae844f0a5dbef9219376'
* commit 'b7e64fba7f37cc0399beae844f0a5dbef9219376':
  Reduce the scope of some variables

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 22:40:56 +02:00
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.
2016-05-11 12:21:25 +02:00
Clément Bœsch fb99ef0bd3 avcodec: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:37:05 +01:00
Hendrik Leppkes ee573b4d31 Merge commit 'a17a7661906ba295d67afd80ac0770422e1b02b3'
* commit 'a17a7661906ba295d67afd80ac0770422e1b02b3':
  lavc: Add data and linesize to AVSubtitleRect

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-22 21:41:53 +02:00
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>
2015-10-21 12:02:29 +02:00
Hendrik Leppkes fbd71bba85 Merge commit '1da2a20763ae9ca579d5fd20763065871ddf6311'
* commit '1da2a20763ae9ca579d5fd20763065871ddf6311':
  dvbsubdec: Fix function return type

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-05 11:25:40 +02:00
Vittorio Giovara 1da2a20763 dvbsubdec: Fix function return type 2015-10-04 13:07:12 +02:00
Ronald S. Bultje 6471040f56 FF_OPT_TYPE_* -> AV_OPT_TYPE_*. 2015-08-18 11:48:49 -04:00
Michael Niedermayer d21ab8e411 avcodec/dvbsubdec: Print field lens in case they are too lerge
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-13 01:50:08 +02:00
Carl Eugen Hoyos daf2c35f52 lavc: Remove newline from avpriv_request_sample() calls. 2015-08-11 22:50:45 +02:00
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>
2015-08-05 00:16:43 +02:00
Carl Eugen Hoyos 087c0a0a93 lavc/dvbsub: Do not fail on clut depth 0.
Fixes ticket #4752.
2015-08-04 15:01:22 +02:00
Michael Niedermayer 3f87a17063 avcodec/dvbsubdec: Allow selecting the substream, or all substreams
Fixes Ticket 2161

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-08-04 14:24:13 +02:00
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>
2015-07-29 18:02:07 +02:00
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>
2015-07-27 00:02:48 +02:00
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>
2015-07-26 14:39:55 +02:00
banastasov debf4d6e67 avcodec/dvbsubdec: Fix buf_size check in dvbsub_parse_display_definition_segment()
Fixes Ticket4326

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-30 04:29:58 +02:00
Michael Niedermayer 9f0b898e82 avcodec/dvbsubdec: Clear w/h/size on region buffer allocation failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-14 23:25:39 +02:00
Michael Niedermayer e06dde52d7 avcodec/dvbsubdec: Do not return a value from a function returning void
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-26 13:47:12 +02:00
Michael Niedermayer 8f7b022c8c Merge commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25'
* commit '6a85dfc830f51f1f5c2d36d4182d265c1ea3ba25':
  lavc: Replace av_dlog and tprintf with internal macros

Conflicts:
	libavcodec/aacdec.c
	libavcodec/audio_frame_queue.c
	libavcodec/bitstream.c
	libavcodec/dcadec.c
	libavcodec/dnxhddec.c
	libavcodec/dvbsubdec.c
	libavcodec/dvdec.c
	libavcodec/dvdsubdec.c
	libavcodec/get_bits.h
	libavcodec/gifdec.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_refs.c
	libavcodec/imc.c
	libavcodec/interplayvideo.c
	libavcodec/jpeglsdec.c
	libavcodec/libopencore-amr.c
	libavcodec/mjpegdec.c
	libavcodec/mpeg12dec.c
	libavcodec/mpegvideo_enc.c
	libavcodec/mpegvideo_parser.c
	libavcodec/pngdec.c
	libavcodec/ratecontrol.c
	libavcodec/rv10.c
	libavcodec/svq1dec.c
	libavcodec/vqavideo.c
	libavcodec/wmadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 04:10:10 +02:00
Vittorio Giovara 6a85dfc830 lavc: Replace av_dlog and tprintf with internal macros 2015-04-19 12:41:59 +01:00
Michael Niedermayer c5b6b711b2 Merge commit '607ad990d31e6be52980970e5ce8cd25ab3de812'
* commit '607ad990d31e6be52980970e5ce8cd25ab3de812':
  dvbsubdec: check memory allocations and propagate errors

Conflicts:
	libavcodec/dvbsubdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-27 20:25:40 +01:00
Vittorio Giovara 607ad990d3 dvbsubdec: check memory allocations and propagate errors 2015-01-27 15:26:37 +00:00
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>
2015-01-17 16:33:02 +01:00
Michael Niedermayer 1bf747ae84 avcodec/dvbsubdec: Return proper error codes from more functions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 19:24:27 +01:00
Michael Niedermayer ebe3a41ea3 avcodec/dvbsubdec: Add some av_malloc() failure checks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 19:21:58 +01:00
Michael Niedermayer ce800d4695 avcodec/dvbsubdec: Remove redundant "DVBSub error" prefix
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-06 02:03:08 +01:00
Michael Niedermayer 4ba0141921 avcodec/dvbsubdec: Pass context to av_log()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-05 20:33:57 +01:00