Commit Graph

83 Commits

Author SHA1 Message Date
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01: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
Vittorio Giovara 8e104619a6 shorten: check for return value
Avoid a possible negative bitshift.

CC: libav-stable@libav.org
Bug-Id: CID 1194400
2014-11-13 01:41:26 +01:00
Anton Khirnov 1713eec29a shorten: pad the internal bitstream buffer
Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-02-04 21:59:57 +01:00
Alexandra Khirnova 9b8d11a76a avcodec: Use av_reallocp where suitable
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-12-09 12:27:51 +02:00
Tim Walker 5f5ada3dbf shorten: Fix out-of-array read
pred_order == FF_ARRAY_ELEMS(fixed_coeffs) is invalid too.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-10 17:52:14 +02:00
Luca Barbato b2148faca9 shorten: Extend fixed_coeffs to properly support pred_order 0
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-10-09 03:34:10 +02:00
Diego Biurrun b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Martin Storsjö b26742cc30 shorten: Break out of loop looking for fmt chunk if none is found
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-12 10:53:04 +03:00
Martin Storsjö 49568851bf shorten: Use a checked bytestream reader for the wave header
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-12 10:52:42 +03:00
Anton Khirnov 759001c534 lavc decoders: work with refcounted frames. 2013-03-08 07:38:30 +01:00
Luca Barbato 5cf7c72757 shorten: use the unsigned type where needed
get_uint returns an unsigned value, use an unsigned to store
blocksize to make sure the comparison logic is correct and report
correctly the error for the channel count not supported.
2013-03-06 01:04:02 +01:00
Luca Barbato 4c364eb2b8 shorten: report meaningful errors 2013-03-06 01:04:02 +01:00
Luca Barbato a2ad554def shorten: K&R formatting cosmetics 2013-03-06 01:04:02 +01:00
Michael Niedermayer c10da30d84 shorten: set invalid channels count to 0
Prevent the loop shorten_decode_close from writing and freeing out of
the array boundary.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-06 01:04:01 +01:00
Justin Ruggles fed74c0ae4 shorten: decode directly to the user-provided AVFrame 2013-02-12 12:22:38 -05:00
Luca Barbato 4839fbe2d1 shorten: fix array subscript is below array bounds warning
Incidentally fixes alpha builds.
2013-01-28 07:24:51 +01:00
Diego Biurrun 511cf612ac miscellaneous typo fixes 2012-12-21 00:18:34 +01:00
Anton Khirnov 594d4d5df3 lavc: add a wrapper for AVCodecContext.get_buffer().
It will be useful in the upcoming transition to refcounted AVFrames.
2012-12-04 21:41:59 +01:00
Justin Ruggles 4c53f4aed3 shorten: validate that the channel count in the header is not <= 0 2012-11-01 11:29:18 -04:00
Justin Ruggles 977eb7d567 shorten: use planar sample format 2012-10-14 16:48:22 -04:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Martin Storsjö 00c3b67b8a cosmetics: Align codec declarations
Also break some long lines, remove codec function placeholder comments
and add spaces in sample/pixel format lists.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 22:37:38 +03:00
Michael Niedermayer 204cb29b3c shorten: Use separate pointers for the allocated memory for decoded samples.
Fixes invalid free() if any of the buffers are not allocated due to either
not decoding a header or an error prior to allocating all buffers.

Fixes CVE-2012-0858
CC: libav-stable@libav.org

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-02-16 15:18:45 -05:00
John Brooks 8562d9bd6c shorten: avoid abort() on unknown audio types
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-12-08 11:30:24 +01:00
Paul B. Mahol eda8731285 shorten: remove dead initialization
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2011-12-04 15:12:05 -05:00
Justin Ruggles 0eea212943 Add avcodec_decode_audio4().
Deprecate avcodec_decode_audio3().
Implement audio support in avcodec_default_get_buffer().
Implement the new audio decoder API in all audio decoders.
2011-12-02 17:40:40 -05:00
Justin Ruggles 5c210e2cb9 shorten: do not modify samples pointer when interleaving 2011-11-11 14:18:22 -05:00
Justin Ruggles 1baa25c7da shorten: fix end-of-stream decoding.
enable CODEC_CAP_DELAY to flush any remaining frames in the buffer.

Stop decoding when the FN_QUIT command is found so that a trailing seek table
isn't decoded as a normal frame.

decode all channels in the same call to avcodec_decode_audio3() so that
decoding will not stop after the first channel of the last frame.

Updated FATE reference. More valid audio is now decoded.
2011-10-20 13:09:46 -04:00
Justin Ruggles d03f9f65c0 shorten: do not use block size to determine whether to read the header. 2011-10-20 13:09:46 -04:00
Justin Ruggles 882dafe9b6 shorten: check output buffer size before decoding 2011-10-20 13:09:26 -04:00
Justin Ruggles bd7f7d6c78 shorten: use av_clip_int16() for output sample clipping 2011-10-20 13:09:26 -04:00
Justin Ruggles 069ada46c1 shorten: use bytestream functions to decode the embedded WAVE header 2011-10-20 13:09:25 -04:00
Justin Ruggles c25762fcf1 shorten: add some comments 2011-10-20 13:09:25 -04:00
Justin Ruggles 15d146c958 shorten: merge decoding of FN_DIFF* subblocks into decode_subframe_lpc() 2011-10-20 13:09:25 -04:00
Justin Ruggles 034f42dfce cosmetics: remove some needless commented-out stuff 2011-10-20 13:09:25 -04:00
Justin Ruggles cfa317f67d shorten: validate block size 2011-10-20 13:09:25 -04:00
Justin Ruggles 45d7d31fb9 shorten: move declaration of 'ret' to top of shorten_decode_frame() 2011-10-20 13:09:25 -04:00
Justin Ruggles a8055992c0 shorten: pass on error value from allocate_buffers() instead of returning -1 2011-10-20 13:09:25 -04:00
Justin Ruggles 9e5e2c2d01 shorten: check for realloc failure 2011-10-20 13:09:25 -04:00
Justin Ruggles fe31a637f1 shorten: move decoding of prediction order and applying of global offset to
decode_subframe_lpc().
2011-10-20 13:09:25 -04:00
Justin Ruggles 0f97c5014b shorten: only calculate output size when returning decoded samples, otherwise
just set data_size to zero.
2011-10-20 13:09:25 -04:00
Justin Ruggles e9e37f2d10 cosmetics: reindent 2011-10-20 13:09:25 -04:00
Justin Ruggles 9000b6db22 shorten: separate processing of audio commands from non-audio commands 2011-10-20 13:09:25 -04:00
Justin Ruggles 07745485ef shorten: skip some fields in the WAV header embedded in the shorten header.
fixes incorrect bitrate reporting and potential misreporting of the number of
channels.
2011-10-20 13:09:25 -04:00
Justin Ruggles a1f7885a8b shorten: split reading of file header into a separate functions 2011-10-20 13:09:25 -04:00
Justin Ruggles 617a51f9b7 shorten: remove the flush function.
The shorten decoder does not support seeking.
2011-10-13 16:31:16 -04:00
Laurent Aimar 5f05cf4ea9 shorten: Fix out of bound writes in fix_bitshift()
The data pointers s->decoded[*] already take into account s->nwrap.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-07 16:25:31 +02:00
Laurent Aimar 95010d18b2 shorten: Prevent block size from increasing
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-07 16:25:30 +02:00
Anton Khirnov ec6402b7c5 lavc: use designated initialisers for all codecs.
It's more readable and less prone to breakage.
2011-07-29 08:42:34 +02:00