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

96 Commits

Author SHA1 Message Date
Limin Wang
766888e519 avcodec/pgssubdec: 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>
2020-03-25 18:41:21 +01:00
Michael Niedermayer
b0a718923b avcodec/pgssubdec: Free subtitle on error
Fixes: Assertion failure
Fixes: 19753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGSSUB_fuzzer-5688461843759104

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>
2020-01-05 20:31:42 +01:00
Michael Niedermayer
e35c3d887b avcodec/pgssubdec: Check for duplicate display segments
In such a duplication the previous gets overwritten and leaks

Fixes: memleak
Fixes: 12510/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGSSUB_fuzzer-5694439226343424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-02-03 19:40:20 +01:00
Andreas Cadhalpun
842e98b4d8 pgssubdec: reset rle_data_len/rle_remaining_len on allocation error
The code relies on their validity and otherwise can try to access a NULL
object->rle pointer, causing segmentation faults.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2017-02-01 02:21:28 +01:00
Andreas Cadhalpun
995512328e pgssubdec: only set w/h/linesize when allocating data
Rects with positive w/h/linesize but no data are invalid.

Reviewed-by: Petri Hintukainen <phintuka@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-11-24 01:48:43 +01: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
Clément Bœsch
475a686a01 Merge commit '885a9d6087315a85d98f7e89656ef01dc7104c4c'
* commit '885a9d6087315a85d98f7e89656ef01dc7104c4c':
  pgssub: Fix subpicture colorspace and range

See 9779b62624

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 22:20:49 +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
Jan Ekström
885a9d6087 pgssub: Fix subpicture colorspace and range
Widen the values from limited to full range and use BT.709 where it
should be used according to the video resolution:

SD is BT.601, HD is BT.709

Default to BT.709 due to most observed HDMV content being HD.
2016-05-10 11:30:25 +02:00
Jan Ekström
9779b62624 pgssubdec: fix subpicture output colorspace and range
Functionality used before didn't widen the values from limited to
full range. Additionally, now the decoder uses BT.709 where it
should be used according to the video resolution.

Default for not yet set colorimetry is BT.709 due to most observed
HDMV content being HD.

BT.709 coefficients were gathered from the first two parts of BT.709
to BT.2020 conversion guide in ARIB STD-B62 (Pt. 1, Chapter 6.2.2).
They were additionally confirmed by manually calculating values.

Fixes #4637
2016-04-24 23:05:04 +02:00
Michael Niedermayer
4f2419888b avcodec/pgssubdec: Fix left shift of 255 by 24 places cannot be represented in type int
Fixes: b293a6479bb4b5286cff24d356bfd955/asan_generic_225c3c9_7819_cc526b657450c6cdef1371b526499626.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-04 21:39:14 +01:00
Petri Hintukainen
7139489c45 pgssubdec: fix API compability layer
Copy pointers to AVPicture after memory has been allocated.
Fixes NULL pointers in AVPicture after a17a766190.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-11-26 10:55:36 +01:00
Michael Niedermayer
ebf5264cd6 avcodec/pgssubdec: Check dimensions for 0
Fixes division by 0
Fixes: b293a6479bb4b5286cff24d356bfd955/asan_generic_225c3c9_7819_cc526b657450c6cdef1371b526499626.mkv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-14 18:26:11 +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
Clément Bœsch
8e22becbc7 avcodec/pgssubdec: use AV_OPT_TYPE_BOOL for forced_subs_only option 2015-09-12 18:24:49 +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
4207c5a4ce avcodec/pgssubdec: Use av_malloc*_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-11 13:41:14 +01:00
Michael Niedermayer
7db3a46a3d Merge commit 'd98e6c5d5d80c1dfe0c30f2e73d41a3aea0b920d'
* commit 'd98e6c5d5d80c1dfe0c30f2e73d41a3aea0b920d':
  pgssubdec: Check RLE size before copying

See: c0d68be555
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-01 04:46:50 +02:00
Michael Niedermayer
d98e6c5d5d pgssubdec: Check RLE size before copying
Make sure the buffer size does not exceed the expected
RLE size.

Prevent an out of array bound write.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Bug-Id: CVE-2013-0852

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-08-01 02:13:32 +02:00
Michael Niedermayer
2cebd17e3f avcodec/pgssubdec: Fix input pts
Fixes part of Ticket2516

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-12 01:09:51 +02:00
Michael Niedermayer
e429d6c197 avcodec/pgssubdec: remove unused variables
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 18:24:37 +02:00
Michael Niedermayer
89bcb77726 avcodec/pgssubdec: Check input buffer size in parse_presentation_segment()
Might fix overread, no testcase known though.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 18:23:08 +02:00
Michael Niedermayer
ae9a73de2a Merge commit '253d0be6a1ecc343d29ff8e1df0ddf961ab9c772'
* commit '253d0be6a1ecc343d29ff8e1df0ddf961ab9c772':
  pgssubdec: handle more complex PGS scenarios

Conflicts:
	libavcodec/pgssubdec.c

Some of this has been split out and commited in cleanly split patches immedeately
before this merge

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 18:05:39 +02:00
John Stebbins
0c911c8fbc avcodec/pgssubdec: fix end display time
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 17:33:53 +02:00
John Stebbins
066a4819cc avcodec/pgssubdec: Bail out of decode_rle() if error and AV_EF_EXPLODE is set
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 17:31:38 +02:00
John Stebbins
fc7da418ff avcodec/pgssubdec: better error codes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 17:29:18 +02:00
John Stebbins
5c019ec91d avcodec/pgssubdec: Pass AVSubtitleRect to decode_rle()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 17:25:16 +02:00
John Stebbins
4701f7676c avcodec/pgssubdec: split out flush_cache()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 17:24:47 +02:00
John Stebbins
ca7f2a7372 avcodec/pgssubdec: do not fail when part of the packet is faulty unless AV_EF_EXPLODE is set
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 16:46:25 +02:00
John Stebbins
376f353e3d avcodec/pgssubdec: rename PICTURE_SEGMENT
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-30 16:39:41 +02:00
John Stebbins
253d0be6a1 pgssubdec: handle more complex PGS scenarios
Add ability to handle multiple palettes and objects simultaneously.
Each simultaneous object is given its own AVSubtitleRect.
Note that there can be up to 64 currently valid objects, but only
2 at any one time can be "presented".

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-06-30 12:18:58 +02:00
Michael Niedermayer
e8e9186a70 avcodec/pgssubdec: Use av_malloc(z)_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-22 15:04:34 +02:00
Michael Niedermayer
672c610d84 Merge commit 'f9279ee74936b4990fc46287c27816ef828cc06c'
* commit 'f9279ee74936b4990fc46287c27816ef828cc06c':
  dsputil: Move ff_zigzag_direct and ff_crop_tab declarations to mathops.h

Conflicts:
	libavcodec/imgconvert.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-22 22:23:04 +01:00
Diego Biurrun
f9279ee749 dsputil: Move ff_zigzag_direct and ff_crop_tab declarations to mathops.h 2014-03-22 06:17:29 -07:00
Michael Niedermayer
6016b8329b Merge commit '05563ccacc98fd185affdbf8cbaf094caf36b852'
* commit '05563ccacc98fd185affdbf8cbaf094caf36b852':
  dsputil: cosmetics: Lose camelCase on ff_cropTbl and ff_squareTbl names

Conflicts:
	libavcodec/bit_depth_template.c
	libavcodec/motionpixels_tablegen.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-14 00:39:51 +01:00
Diego Biurrun
05563ccacc dsputil: cosmetics: Lose camelCase on ff_cropTbl and ff_squareTbl names
Also switch from "tbl" to "tab" name suffixes.
2014-03-13 08:12:44 -07:00
Michael Niedermayer
1a01dc8343 avcodec/pgssubdec: Use av_fast_padded_malloc() for rle buffer
Fixes: use of uninitialized memeory
Fixes: msan_uninit-mem_7fa421d0e222_1765_Girl_With_The_Dragon_Tattoo_2_23_56.mkv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-15 23:09:22 +01:00
Michael Niedermayer
a897ba33e8 Merge commit '0f21d8b1b40848973558c737aebe800c46e93a3d'
* commit '0f21d8b1b40848973558c737aebe800c46e93a3d':
  pictordec: stop using deprecated avcodec_set_dimensions
  pgssubdec: stop using deprecated avcodec_set_dimensions
  pcx: stop using deprecated avcodec_set_dimensions
  mpegvideo_parser: stop using deprecated avcodec_set_dimensions

Conflicts:
	libavcodec/pcx.c
	libavcodec/pgssubdec.c
	libavcodec/pictordec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-01 15:25:09 +01:00
Anton Khirnov
41ad353dcf pgssubdec: stop using deprecated avcodec_set_dimensions 2013-10-31 20:14:16 +01:00
Michael Niedermayer
ee77140afa Merge commit 'b2bed9325dbd6be0da1d91ffed3f513c40274fd2'
* commit 'b2bed9325dbd6be0da1d91ffed3f513c40274fd2':
  cosmetics: Group .name and .long_name together in codec/format declarations

Conflicts:
	libavcodec/8svx.c
	libavcodec/alac.c
	libavcodec/cljr.c
	libavcodec/dnxhddec.c
	libavcodec/dnxhdenc.c
	libavcodec/dpxenc.c
	libavcodec/dvdec.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/ffv1dec.c
	libavcodec/flacdec.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/g726.c
	libavcodec/gif.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/h263dec.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopencore-amr.c
	libavcodec/libopenjpegdec.c
	libavcodec/libopenjpegenc.c
	libavcodec/libspeexenc.c
	libavcodec/libvo-amrwbenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/ljpegenc.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg4videodec.c
	libavcodec/msmpeg4dec.c
	libavcodec/pgssubdec.c
	libavcodec/pngdec.c
	libavcodec/pngenc.c
	libavcodec/proresdec_lgpl.c
	libavcodec/proresenc_kostya.c
	libavcodec/ra144enc.c
	libavcodec/rawdec.c
	libavcodec/rv10.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tta.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/wavpack.c
	libavcodec/xbmenc.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-04 12:34:23 +02:00
Diego Biurrun
b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Thilo Borgmann
f18ccb529f Fix wrong use of "an" in some comments. 2013-08-12 03:27:26 +02:00
Paul B Mahol
6549a9b753 pgssubdec: remove unused variable
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2012-11-28 16:21:25 +00:00
Michael Niedermayer
4116151a4b Merge commit '1c5805521c3e406886341d752ebf38f8d41e1d13'
* commit '1c5805521c3e406886341d752ebf38f8d41e1d13':
  PGS subtitles: Set AVSubtitle pts value
  configure: Refactor CPPFLAGS settings for glibc/uclibc
  configure: add basic support for ARM AArch64
  build: set -U__STRICT_ANSI__ for newlib

Conflicts:
	configure
	libavcodec/pgssubdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-19 14:05:41 +01:00
John Stebbins
1c5805521c PGS subtitles: Set AVSubtitle pts value
pts should be that of the packet containing the presentation segment.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-11-18 18:34:05 +01:00
Michael Niedermayer
c0d68be555 pgssubdec: check RLE size before copying. Fix out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-15 16:46:51 +01:00
Michael Niedermayer
1885ffb03d Merge commit '9a07c1332cfe092b57b5758f22b686ca58806c60'
* commit '9a07c1332cfe092b57b5758f22b686ca58806c60':
  parser: Move Doxygen documentation to the header files
  PGS subtitles: Expose forced flag
  x86: PMINUB: port to cpuflags

Conflicts:
	libavcodec/avcodec.h
	libavcodec/pgssubdec.c
	libavcodec/version.h
	libavcodec/x86/ac3dsp.asm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-03 14:13:45 +01:00
John Stebbins
85f67c4865 PGS subtitles: Expose forced flag
Useful for detection of subtitles displayed during foreign language
scenes.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-11-02 16:13:35 +01:00