Commit Graph

346 Commits

Author SHA1 Message Date
Michael Niedermayer
b12b05374f avcodec/adpcm: Fix integer overflow in ADPCM THP
The reference (thp.txt) uses floats so wrap around would seem incorrect.

Fixes: signed integer overflow: 1073741824 + 1073741824 cannot be represented in type 'int'
Fixes: 20658/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_THP_fuzzer-5646302555930624

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-13 09:03:45 +02:00
Michael Niedermayer
8ee264e684 avcodec/adpcm: Clip predictor for IMA_APM
Fixes: signed integer overflow: -2147483647 - 61436 cannot be represented in type 'int'
Fixes: 20492/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_APM_fuzzer-5092176004644864

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-05-11 00:45:09 +02:00
Zane van Iperen
3e22e738c0 avcodec: add support for Cunning Developments' ADPCM
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-24 19:43:04 +02:00
Zane van Iperen
0bce55ac89 avcodec/adpcm: update get_nb_samples() doc
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-20 20:03:00 +02:00
Zane van Iperen
7150123aab avcodec/adpcm_ima_{apc, ssi, oki}: replace while() with for()
Per discussion at https://ffmpeg.org/pipermail/ffmpeg-devel/2020-April/260854.html

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-20 20:03:00 +02:00
Zane van Iperen
67c4405fac avcodec/adpcm: remove unused shift parameter from adpcm_ima_qt_expand_nibble()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-04-11 17:01:18 +02:00
Paul B Mahol
230703a9fa avcodec: add ADPCM IMA MTF decoder 2020-03-17 16:03:39 +01:00
Michael Niedermayer
0a11ef68f0 avcodec/adpcm: Fix invalid shift in AV_CODEC_ID_ADPCM_PSX
Fixes: left shift of negative value -1
Fixes: 20859/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_PSX_fuzzer-5720391507247104

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-11 23:57:04 +01:00
Zane van Iperen
d90413e1e5 avcodec: add decoder for High Voltage Software's ALP ADPCM
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-03-09 01:43:51 +01:00
Michael Niedermayer
ac73879f1b avcodec/adpcm: Clip step index for ADPCM_IMA_APM
Fixes: out of array access
Fixes: 20828/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_APM_fuzzer-5712770106654720

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-03-02 23:39:06 +01:00
Paul B Mahol
553d836d62 avcodec/adpcm: cosmetics; reindent 2020-02-21 14:47:29 +01:00
Zane van Iperen
af65357207 avcodec: add decoder for Rayman 2's ADPCM variant
Adds support for the ADPCM variant used in Rayman 2's files.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-02-21 14:46:19 +01:00
Paul B Mahol
dfb0b9370d avcodec: fix pcm zork decoder
Fixes #1939
2020-02-16 12:54:57 +01:00
Zane van Iperen
5d038a86d6 avcodec: add decoder for Simon & Schuster Interactive's ADPCM variant
Adds support for the ADPCM variant used by some Simon & Schuster
Interactive games such as Real War, and Real War: Rogue States.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-06 17:26:22 +01:00
Zane van Iperen
b49404ea30 avcodec/adpcm_argo: simplify and move duplicated logic into a function
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-02 17:09:14 +01:00
Zane van Iperen
bf890ae0d7 avcodec: add decoder for argonaut games' adpcm codec
Adds support for the ADPCM variant used by some Argonaut Games' games,
such as 'Croc! Legend of the Gobbos', and 'Croc 2'.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-01-26 10:23:54 +01:00
Andreas Rheinhardt
3ad8af51b7 avcodec/adpcm: Fix undefined left shifts of negative numbers
Affected the adpcm-afc, adpcm-ea-1, adpcm-ea-2, adpcm-ea-maxis-xa,
adpcm-thp and ea-cdata FATE-tests. Also fixes ticket #8487.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-21 10:01:46 +01:00
Michael Niedermayer
794352ae9d avcodec/adpcm: Fix overflow in FFABS() IMA_EA_EACS
Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 19235/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_EA_EACS_fuzzer-5680878952382464

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-01-11 23:31:18 +01:00
Michael Niedermayer
9fe07908c3 avcodec/adpcm: Clip predictor for APC
Fixes: signed integer overflow: -2147483648 - 13 cannot be represented in type 'int'
Fixes: 18893/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_APC_fuzzer-5630760442920960

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer
50db30b47d avcodec/adpcm: Fix invalid shift in xa_decode()
Fixes: left shift of negative value -1
Fixes: 18859/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_XA_fuzzer-5748474213040128

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-15 01:01:22 +01:00
Michael Niedermayer
7786f6c30e avcodec/adpcm: Fix undefined behavior with negative predictions in IMA OKI
Fixes: left shift of negative value -30
Fixes: 18392/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_OKI_fuzzer-5631771831435264

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-09 18:03:37 +01:00
Michael Niedermayer
34e701ff93 avcodec/adpcm: Fix invalid shifts in ADPCM DTK
Fixes: left shift of negative value -1
Fixes: 18397/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_DTK_fuzzer-5675653487132672

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>
2019-10-29 16:20:33 +01:00
Michael Niedermayer
2f66e8436d avcodec/adpcm: Check initial predictor for ADPCM_IMA_EA_EACS
Fixes: signed integer overflow: -2147483360 - 631 cannot be represented in type 'int'
Fixes: 17701/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_IMA_EA_EACS_fuzzer-5711517319692288

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-16 19:17:57 +02:00
Michael Niedermayer
8695fbec57 avcodec/adpcm: Fix left shifts in AV_CODEC_ID_ADPCM_EA
Fixes: left shift of negative value -1
Fixes: 17683/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_EA_R2_fuzzer-5111690013704192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-10-16 19:17:57 +02:00
Michael Niedermayer
74bbf9bc82 avcodec/adpcm: Check number of channels for MTAF
Fixes: out of array access
Fixes: 17608/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_MTAF_fuzzer-5074936267276288

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>
2019-09-24 12:24:41 +02:00
Paul B Mahol
ebfcd4be33 avcodec/adpcm: reindent after last commit 2019-07-26 11:57:16 +01:00
Paul B Mahol
f79873409b avcodec/adpcm: add support for 5.1 ADPCM MS 2019-07-26 11:57:06 +01:00
Andreas Rheinhardt
a1a8815220 libavcodec: Reduce the size of some arrays
This commit uses smaller types for some static const arrays to reduce
their size in case the entries can be represented in the smaller type.
The biggest savings came from inv_map_table in vp9.c.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2019-06-20 14:47:46 -03:00
Paul B Mahol
d0f24df648 avcodec: add ADPCM AGM decoder 2019-04-11 11:58:34 +02:00
Michael Niedermayer
2d9fe6321e avcodec/adpcm: use assert for codec id instead or error return
A unsupported codec_id is a internal error and should not happen

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-01 21:11:47 +01:00
Misty De Meo
94e6b5ac39 adpcm: consume remainder after consuming XA chunks
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-01-06 03:14:38 +01:00
Paul B Mahol
ee4aa388b2 adpcm: fix clipping for yamaha
According to specification max value allowed is 0x6000.
Fixes #5862.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-02-15 12:46:01 +01:00
Paul B Mahol
b82c1a377a avcodec/adpcm: clip step for ADPCM MTAF decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-09-15 17:24:40 +02:00
Michael Niedermayer
f2a9a30fd6 avcodec/adpcm: Fix adpcm_ima_wav padding
Fixes out of array read
Fixes: f29f134ea5f5590df554a7733294a587/asan_stack-oob_309d14e_9188_ea01743d6355aff20530f3d4cdaa841a.wav

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-21 02:44:15 +02:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Paul B Mahol
8c17eea46f avcodec: add adpcm MTAF decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-05-21 18:49:45 +02:00
Paul B Mahol
14992421df avcodec/adpcm: pick correct step_index for IMA AMV
Fixes #5538

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-05-19 23:48:25 +02:00
Vittorio Giovara
41ed7ab45f cosmetics: Fix spelling mistakes
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 18:16:21 +02:00
Paul B Mahol
66eb5b809a avcodec/adpcm: fix decoding of stereo non 4-bit ADPCM IMA WAV
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-05-04 11:33:34 +02:00
Paul B Mahol
3395ad48fa avcodec/adpcm: replace char/short/long with int8_t/int16_t/int
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-05-04 00:36:02 +02:00
Paul B Mahol
8a4c3f5258 avcodec: add adpcm dat4 decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-04-05 10:48:59 +02:00
Paul B Mahol
af3f793f60 avcodec: add ADPCM AICA decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-29 21:26:43 +01:00
Paul B Mahol
8dea76180c avcodec: extend long decription for adpcm psx codec
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-23 19:07:37 +02:00
Paul B Mahol
7bbd060324 avcodec/adpcm: increase max channels for ADPCM PSX to 8
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-18 14:17:15 +02:00
Paul B Mahol
8b11e43799 avcodec: add ADPCM PSX decoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-16 16:37:40 +02:00
Rodger Combs
3f9fa2d0b5 ADPCM: Bump THP channel limit to 14
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-12 22:09:35 +02:00
Michael Niedermayer
66a7bc0010 avcodec/adpcm: Check init_get_bits8() for failure
Fixes CID1322317

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-04 12:03:37 +02: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
Rodger Combs
7d0a19757e lavc/adpcm: THP: set approx_nb_samples correctly
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-28 16:42:25 +02:00