Commit Graph

98 Commits

Author SHA1 Message Date
wm4 b895e29941 avcodec/dvdsubdec: fix accessing dangling pointers
dvdsub_decode() can call append_to_cached_buf() 2 times, the second time
with ctx->buf as argument. If the second append_to_cached_buf() reallocs
ctx->buf, the argument will be a pointer to the previous, freed block.
This can cause invalid reads at least with some fuzzed files - and
possibly with valid files.

Since packets can apparently not be larger than 64K (even if packets are
combined), just use a fixed size buffer. It will be allocated as part of
the DVDSubContext, and although some memory is "wasted", it's relatively
minimal by modern standards and should be acceptable.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 816577716b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
wm4 3d71024f8a avcodec/dvdsubdec: error on bitmaps with size 0
Attemtping to decode them could lead to invalid writes with some fuzzed
samples.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bcaa9099b3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
wm4 e0a12b3dc3 avcodec/dvdsubdec: fix out of bounds accesses
The code blindly trusted buffer offsets read from the file in the RLE
decoder. Explicitly check the offset. Also error out on other RLE
decoding errors.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c9151de7c4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-09 17:19:10 +01:00
Michael Niedermayer ac967ad872 Merge commit 'd466d82faaf6e0e57a3a4be5e38e3902ef251ac3'
* commit 'd466d82faaf6e0e57a3a4be5e38e3902ef251ac3':
  dvdsubdec: Do not leak on failure path

Conflicts:
	libavcodec/dvdsubdec.c

See: 7fa9f7ef1c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-21 22:36:01 +01:00
Luca Barbato d466d82faa dvdsubdec: Do not leak on failure path
CC: libav-stable@libav.org
Bug-Id: CID 1198262
2014-11-21 12:36:19 +00:00
Michael Niedermayer 1de786777e avcodec/dvdsubdec: Check all fseek()s return codes
Fixes CID1254660

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-16 17:50:18 +01:00
Shin-ichi Toyama 12630fa821 avcodec/dvdsubdec: New option for obtaining global palette from .IFO file (experimental)
Suggested-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-15 12:50:39 +01:00
Nicholas Robbins c7d21dee28 libavcodec/dvdsubdec: Add option forced_subs_only to only decode forced subtitle frames.
Signed-off-by: Nicholas Robbins <nickrobbins@yahoo.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-22 21:01:13 +02:00
Michael Niedermayer 5c073bbb57 avcodec/dvdsubdec: fix VD/SD identifier name
Found-by: Nicholas Robbins <nickrobbins-at-yahoo.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-19 23:47:20 +02:00
Michael Niedermayer 2d7cec14be avcodec/dvdsubdec: Dont mix integers with pointers
Reviewed-by: James Darnley <james.darnley@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-16 15:58:40 +02:00
Michael Niedermayer fb33bff990 Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39':
  cosmetics: Write NULL pointer equality checks more compactly

Conflicts:
	cmdutils.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/dvbsub.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/dxa.c
	libavcodec/libxvid_rc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/rv10.c
	libavcodec/tiffenc.c
	libavcodec/utils.c
	libavcodec/vc1dec.c
	libavcodec/zmbv.c
	libavdevice/v4l2.c
	libavformat/matroskadec.c
	libavformat/movenc.c
	libavformat/sdp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 21:00:50 +02:00
Gabriel Dume 4b1f5e5090 cosmetics: Write NULL pointer inequality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 05:34:13 -07:00
Gabriel Dume f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Michael Niedermayer dd200c56c0 avcodec/dvdsubdec: free subtitle rectangles if nothing is output
Fixes assertion failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-31 14:17:46 +02:00
Oliver Fromme d73823286d avcodec/dvdsubdec: fix alpha in debuging code
improve the debugging function for saving subtitles
to PPM files: Actually use the alpha channel.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-04 00:35:21 +02:00
Oliver Fromme 3f0a3e9e12 avcodec/dvdsubdec: Fix off-by-one error
Fix an off-by-one error that causes the height of decoded
subtitles to be too small, thus cutting off the lowest row
of pixels.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-04 00:32:43 +02:00
Michael Niedermayer 5440151fa4 Merge commit '3dc6272bed7890a49080e18eacf3c7a4a6594b0d'
* commit '3dc6272bed7890a49080e18eacf3c7a4a6594b0d':
  Remove a number of unnecessary dsputil.h #includes

Conflicts:
	libavcodec/h264pred.c
	libavcodec/vc1dsp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-05 18:54:15 +02:00
Diego Biurrun 3dc6272bed Remove a number of unnecessary dsputil.h #includes 2014-04-04 19:08:05 +02: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 7fa9f7ef1c dvdsub_parse_extradata: fix memleak
Fixes CID1135765
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-10 18:30:44 +01:00
Michael Niedermayer b7fea3daab libavcodec/dvdsubdec: remove exit() call in debug code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-08 00:42:50 +01:00
Michael Niedermayer 48f37664a8 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Remove #undefs for formerly forbidden system functions

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-07 23:39:31 +01:00
Diego Biurrun 86f910806b Remove #undefs for formerly forbidden system functions
The macros forbidding the system functions no longer exist, obviating
the need for the #undefs.
2013-11-07 00:26:15 +01:00
Michael Niedermayer 4a35651267 Merge commit 'd6da372984c87fd6288c148c291065d6032ceda3'
* commit 'd6da372984c87fd6288c148c291065d6032ceda3':
  eacmv: stop using deprecated avcodec_set_dimensions
  dvdsubdec: stop using deprecated avcodec_set_dimensions
  dvdec: stop using deprecated avcodec_set_dimensions
  dpx: stop using deprecated avcodec_set_dimensions

Conflicts:
	libavcodec/dpx.c
	libavcodec/dvdec.c
	libavcodec/dvdsubdec.c
	libavcodec/eacmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-01 14:01:02 +01:00
Anton Khirnov babbec0867 dvdsubdec: stop using deprecated avcodec_set_dimensions 2013-10-31 20:14:15 +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
Clément Bœsch 95cafeb684 avcodec/dvdsubdec: reconstruct incomplete SPU packets. 2013-10-04 07:59:48 +02:00
Clément Bœsch 71e0ae22ac avcodec/dvdsubdec: extract every subtitle in a different file (debug).
Even thought a generic solution would be more relevant, this is
currently helpful while debugging.
2013-10-04 07:59:48 +02:00
Clément Bœsch 41fd6f0796 avcodec/dvdsubdec: factor out rectangles reset. 2013-10-04 07:59:48 +02:00
Diego Biurrun b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Carl Eugen Hoyos 0915b531bc Rename "AVClass class" as "AVClass component_class".
The aix header math.h defines "extern int class()" for C.
2013-06-30 13:47:45 +02:00
Michael Niedermayer efc08e00cc Merge commit 'b3ea76624ad1baab0b6bcc13f3f856be2f958110'
* commit 'b3ea76624ad1baab0b6bcc13f3f856be2f958110':
  vf_aspect: use the name 's' for the pointer to the private context
  Remove commented-out debug #define cruft

Conflicts:
	libavcodec/4xm.c
	libavcodec/dvdsubdec.c
	libavcodec/ituh263dec.c
	libavcodec/mpeg12.c
	libavfilter/avfilter.c
	libavfilter/vf_aspect.c
	libavfilter/vf_fieldorder.c
	libavformat/rtmpproto.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-16 09:56:43 +02:00
Diego Biurrun 2832ea26f3 Remove commented-out debug #define cruft 2013-05-16 00:23:30 +02:00
Michael Niedermayer a1f234be11 make the ordering of the return type and av_cold consistent
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-05 13:13:00 +02:00
Michael Niedermayer 0aa095483d Merge commit '6fee1b90ce3bf4fbdfde7016e0890057c9000487'
* commit '6fee1b90ce3bf4fbdfde7016e0890057c9000487':
  avcodec: Add av_cold attributes to init functions missing them

Conflicts:
	libavcodec/aacpsy.c
	libavcodec/atrac3.c
	libavcodec/dvdsubdec.c
	libavcodec/ffv1.c
	libavcodec/ffv1enc.c
	libavcodec/h261enc.c
	libavcodec/h264_parser.c
	libavcodec/h264dsp.c
	libavcodec/h264pred.c
	libavcodec/libschroedingerenc.c
	libavcodec/libxvid_rc.c
	libavcodec/mpeg12.c
	libavcodec/mpeg12enc.c
	libavcodec/proresdsp.c
	libavcodec/rangecoder.c
	libavcodec/videodsp.c
	libavcodec/x86/proresdsp_init.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-05 11:34:29 +02:00
Diego Biurrun 6fee1b90ce avcodec: Add av_cold attributes to init functions missing them 2013-05-04 21:09:45 +02:00
Michael Niedermayer 024a5f72ee Merge commit '9e0f14f16cfc9456a691655fda7d01090bffe47e'
* commit '9e0f14f16cfc9456a691655fda7d01090bffe47e':
  lavc: Make pointers to ff_cropTbl const
  vp3: Embed idct_permutation array directly in VP3DecoderContext

Conflicts:
	libavcodec/bit_depth_template.c
	libavcodec/vp3.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-08 12:47:49 +02:00
Martin Storsjö 9e0f14f16c lavc: Make pointers to ff_cropTbl const
There's no point in these pointers not being const.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-08 12:38:33 +03:00
Reimar Döffinger efa7f42020 Use the avstring.h locale-independent character type functions
Make sure the behavior does not change with the locale.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 15:16:36 +02:00
Reimar Döffinger 88d55b827d Remove incorrect use of ctype.h functions.
As far as I can tell the code should not change behaviour
depending on locale in any of these places.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2013-03-03 21:44:10 +01:00
Clément Bœsch 40976257bc dvdsubdec: parse the size from the extradata
Signed-off-by: Alexandra Khirnova <alexandra.khirnova@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-19 15:12:58 +01:00
Michael Niedermayer 06af724c56 Merge commit 'fb845ffdd335a1efd6dfd43e8adeb530397b348e'
* commit 'fb845ffdd335a1efd6dfd43e8adeb530397b348e':
  h264: add 3 pixels below for subpixel filter wait position
  dvdsubdec: Support palette in mkv

Conflicts:
	libavcodec/dvdsubdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-16 12:01:21 +01:00
Joakim Plate f924d52975 dvdsubdec: Support palette in mkv
Matroska stores palette information as plain text in extradata.

Signed-off-by: Alexandra Khirnova <alexandra.khirnova@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-15 20:51:51 +01:00
Michael Niedermayer 754dd7e889 dvdsubdec: use unsigned shifts to avoid shifting into the sign bit
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-12 21:39:00 +01:00
Nicolas George 217b10de3f lavc/dvdsubdec: accept palette from options.
On DVDs, the palette is part of the IFO file and therefore
not available when reading from a dumped VOB file.
2012-12-05 09:25:48 +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
Clément Bœsch 3b6e9cd7ec lavc/dvdsubdec: parse the size from the extradata. 2012-09-04 23:38:29 +02: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
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00