Commit Graph

203 Commits

Author SHA1 Message Date
Michael Niedermayer
3d23f7a096 avcodec/flacdec: Fix overflow in multiplication in decode_subframe_fixed()
Fixes: signed integer overflow: 2 * 1629495328 cannot be represented in type 'int'
Fixes: 4716/clusterfuzz-testcase-minimized-5835915940331520

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-12-28 20:13:59 +01:00
Michael Niedermayer
560daf8891 avcodec/flacdec: avoid undefined shift
Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int'
Fixes: 4688/clusterfuzz-testcase-minimized-6572210748653568

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-12-28 20:13:59 +01:00
James Almer
ec703910af Merge commit '0f5ad12ba2b538cb329c507ecc914e06bfa70194'
* commit '0f5ad12ba2b538cb329c507ecc914e06bfa70194':
  flac: Use a local cache for decode_residual()

Merged-by: James Almer <jamrial@gmail.com>
2017-11-07 19:08:46 -03:00
James Almer
ff55b62a65 Merge commit '15f1cc09a406cf6296818d475a256902235eefc4'
* commit '15f1cc09a406cf6296818d475a256902235eefc4':
  flac: Postpone unlikely condition checks

Merged-by: James Almer <jamrial@gmail.com>
2017-11-07 18:59:43 -03:00
Luca Barbato
0f5ad12ba2 flac: Use a local cache for decode_residual()
About an additional 4% speedup.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-09 20:51:24 +02:00
Luca Barbato
15f1cc09a4 flac: Postpone unlikely condition checks
About 2% speedup on gcc-6.3.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-09 20:49:57 +02:00
Alexandra Hájková
9c1e111406 flac: Convert to the new bitstream reader
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-09 20:47:53 +02:00
Michael Niedermayer
3f5a68533d avcodec/flacdec: Return error code instead of 0 for failures
Fixes: infinite loop
Fixes: 1418/clusterfuzz-testcase-minimized-5934472438480896

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-09 16:50:18 +02:00
Michael Niedermayer
0a65dae9d0 avcodec/flacdec: reduce limit for golomb so that the max value does not overflow
Fixes: runtime error: left shift of 32 by 26 places cannot be represented in type 'int'

Fixes: 628/clusterfuzz-testcase-6187747641393152
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-21 00:40:20 +01:00
Michael Niedermayer
3e1028c625 avcodec/flac: Fix several integer overflows
Fixes: 686513-media
Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-19 15:58:30 +01:00
Michael Niedermayer
fd00203554 avcodec/flacdec: Check for invalid vlcs
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-04 02:26:37 +01:00
Diego Biurrun
d4c2103bd3 golomb: Convert to the new bitstream reader 2017-01-31 17:46:19 +01:00
Michael Niedermayer
1f5630af51 avcodec/flacdec: Fix undefined shift in decode_subframe()
Fixes undefined behavior
Fixes: 639961-media

Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-04 00:12:06 +01:00
Michael Niedermayer
6567c59c49 avcodec/flac: forward errors from ff_flac_parse_streaminfo()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 23:39:11 +01:00
Michael Niedermayer
83a75bf6c3 avcodec/flacdec: Fix signed integer overflow in decode_subframe_fixed()
Fixes undefined behavior
Fixes: 640912-media

Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-03 17:26:39 +01: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
Ganesh Ajjanagadde
2cbaa078d1 avcodec: use HAVE_THREADS header guards to silence -Wunused-function
When compiled with --disable-pthreads, e.g
http://fate.ffmpeg.org/report.cgi?time=20150917015044&slot=alpha-debian-qemu-gcc-4.7,
a bunch of -Wunused-functions are reported due to missing header guards
around threading related functions.
This patch should silence such warnings.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-10-04 12:47:34 -04:00
Michael Niedermayer
444e9874a7 Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'
* commit 'def97856de6021965db86c25a732d78689bd6bb0':
  lavc: AV-prefix all codec capabilities

Conflicts:
	cmdutils.c
	ffmpeg.c
	ffplay.c
	libavcodec/8svx.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/adpcm.c
	libavcodec/alac.c
	libavcodec/atrac3plusdec.c
	libavcodec/bink.c
	libavcodec/dnxhddec.c
	libavcodec/dvdec.c
	libavcodec/dvenc.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/fic.c
	libavcodec/flacdec.c
	libavcodec/flacenc.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/hevc.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopenjpegdec.c
	libavcodec/libvo-aacenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxdec.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec_float.c
	libavcodec/msmpeg4dec.c
	libavcodec/mxpegdec.c
	libavcodec/nvenc_h264.c
	libavcodec/nvenc_hevc.c
	libavcodec/pngdec.c
	libavcodec/qpeg.c
	libavcodec/ra288.c
	libavcodec/rv10.c
	libavcodec/s302m.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tiff.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/vp9.c
	libavcodec/wavpack.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:50:18 +02:00
Vittorio Giovara
def97856de lavc: AV-prefix all codec capabilities
Express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Michael Niedermayer
b6fcb2bb6d avcodec/flacdec: Attempt to auto-detect old buggy flac
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-17 13:42:32 +02:00
Carl Eugen Hoyos
e609cfd697 lavc/flac: Fix encoding and decoding with high lpc.
Based on an analysis by trac user lvqcl.

Fixes ticket #4421, reported by Chase Walker.
2015-05-17 02:08:58 +02:00
Carl Eugen Hoyos
38f5a266ee lavc/flacdec: Sanitize FLACSTREAMINFO usage. 2015-05-17 02:08:58 +02:00
Michael Niedermayer
5f30522894 avcodec/flacdec: fix off by 1 error
Fixes assertion failure
Fixes: signal_sigsegv_324b284_1980_dilvie___the_dragonfly.flac
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-26 04:11:16 +01:00
Michael Niedermayer
e5c01ccdf5 avcodec/flacdec: Call ff_flacdsp_init() unconditionally
Fixes out of array access
Fixes: signal_sigsegv_324b135_3398_cov_246853371_short.flac
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-26 04:11:08 +01:00
James Almer
3cec54b7d7 x86/flacdsp: add SSE2 and AVX decorrelate functions
Two to four times faster depending on instruction set, block size and channel count.
2014-11-13 13:47:55 -03:00
Michael Niedermayer
cffd2713e9 Merge commit 'acc897e6b15776ed438b88ffe330ec48f6b50e48'
* commit 'acc897e6b15776ed438b88ffe330ec48f6b50e48':
  lavc: make avpriv_flac_is_extradata_valid() private on the next bump

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-06 14:17:46 +01:00
Michael Niedermayer
cfef947f7f Merge commit 'c070a8751597e3aa1b443e88464da785d8966b14'
* commit 'c070a8751597e3aa1b443e88464da785d8966b14':
  lavc: make avpriv_flac_parse_streaminfo() private on the next bump

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-06 13:54:11 +01:00
Anton Khirnov
acc897e6b1 lavc: make avpriv_flac_is_extradata_valid() private on the next bump 2014-11-06 09:04:56 +01:00
Anton Khirnov
c070a87515 lavc: make avpriv_flac_parse_streaminfo() private on the next bump 2014-11-06 09:04:12 +01:00
Michael Niedermayer
7618d360ca Merge commit '7703995a2e8760e66ff35148bf029e0f9e30dbe6'
* commit '7703995a2e8760e66ff35148bf029e0f9e30dbe6':
  flac: Remove unused headers

Conflicts:
	libavcodec/flacdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-26 22:33:28 +02:00
Tristan Matthews
7703995a2e flac: Remove unused headers
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-09-26 10:33:01 -07:00
Michael Niedermayer
6fac482624 avcodec/flacdec: fix handling of av_samples_fill_arrays() return value
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-10 00:21:55 +02:00
Michael Niedermayer
40beec6a43 Merge commit '5fdaf312c5541b77b6364db8b49d6abb416a25c0'
* commit '5fdaf312c5541b77b6364db8b49d6abb416a25c0':
  flac: make avpriv_flac_parse_block_header() inline

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-28 12:33:49 +02:00
Anton Khirnov
5fdaf312c5 flac: make avpriv_flac_parse_block_header() inline
This avoids all the ABI troubles associated with avpriv_.
Since this function is very small and does not depend on any tables,
making it inline should have no adverse effects.
2014-05-28 07:48:30 +02:00
Michael Niedermayer
e9ad121ba5 Fix skiping typos
Found-by: Alessandro Ghedini <alessandro@ghedini.me>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-27 14:50:14 +02:00
Michael Niedermayer
8ca9a68f19 avcodec/flacdec: check rice_order against blocksize
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f6e13c220d0_8489_short.flac
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-07 14:02:53 +01:00
Michael Niedermayer
4b12930f79 avcodec/flacdec: use get_unary() simplify code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-30 14:58:04 +01:00
Michael Niedermayer
9f5b75f241 avcodec/flacdec: make while get_bits loop more robust by checking bits left
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-30 14:39:31 +01:00
Michael Niedermayer
3b56f665b1 avcodec/flacdec: also do crc check when er compliant is set
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-27 09:51:21 +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
Michael Niedermayer
5f312139df Merge commit '45ee556d51ef04d79d52bf6b0b7f28a4d231cb0c'
* commit '45ee556d51ef04d79d52bf6b0b7f28a4d231cb0c':
  qdm2: Whitespace cosmetics
  flac: use meaningful return values

Conflicts:
	libavcodec/flacdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 11:34:07 +02:00
Luca Barbato
0e78ef0f94 flac: use meaningful return values 2013-07-28 14:58:18 +02:00
Paul B Mahol
ff0bdf9375 lavc: copy AVCodecContext for threads
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-06-13 21:49:18 +00:00
Michael Niedermayer
c112e36d41 flacdec: Fix used AVCodecContext
Fixes out of array writes with multiple threads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-13 22:31:54 +02:00
Paul B Mahol
61d900fd0d lavc: add ONLY_IF_THREADS_ENABLED where it is missing
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-06-06 20:17:36 +00:00
Paul B Mahol
a28f4fd1ea flacdec: don't call allocate_buffers() in init_thread_copy() when s->max_blocksize is 0
This is normal, and happens when no extradata was available at decoder
initialization.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-06-06 01:06:45 +00:00
Paul B Mahol
9300de0409 flacdec: frame multi-threading support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-06-05 22:35:31 +00:00
Paul B Mahol
b4d4ef5529 flacdec: use init_get_bits8()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-06-03 19:24:15 +00:00
Luca Barbato
39cc4c61de flacdec: drop unnecessary assert
The condition cannot happen anymore.
2013-05-16 14:05:46 +02:00