Commit Graph

66 Commits

Author SHA1 Message Date
Anton Khirnov ee964145b5 lavc: remove unused traces of fmtconvert usage
Those decoders have been switched to float output and so do not use
fmtconvert anymore.
2015-02-28 21:51:24 +01:00
Vittorio Giovara 31dc73e92a vorbisdec: Check memory allocations 2015-02-17 12:16:43 -05:00
Diego Biurrun 7f9f771eac avcodec: Don't anonymously typedef structs 2015-02-14 10:13:49 -08:00
Diego Biurrun b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Luca Barbato 92b3caa108 vorbis: return meaningful errors 2013-06-07 16:54:16 +02:00
Luca Barbato db347280eb vorbis: fallback to normal division instead of crashing
The use of ff_inverse speeds up slightly arches + compilers that
do not provide a division faster than the whole machinery, such
as ppc32 + gcc4.7, but has operational limits.

Drop the always-enable assert and provide a fallback.
2013-05-19 22:56:37 +02:00
Luca Barbato ddf1b4a2f8 vorbis: simplify the inner loop in setup_classifs 2013-05-19 22:56:37 +02:00
Luca Barbato 36f1038004 vorbis: use normal integer values for iterators
No need to use fixed-size integers.
2013-05-19 22:56:37 +02:00
Luca Barbato 98186578a2 vorbis: refactor vorbis_residue_decode_internal 2013-05-19 22:56:37 +02:00
Anton Khirnov e2c2974120 vorbisdec: do not leak the first frame. 2013-03-10 22:16:26 +01:00
Anton Khirnov 759001c534 lavc decoders: work with refcounted frames. 2013-03-08 07:38:30 +01:00
Luca Barbato 02055b6d40 vorbisdec: check memory allocations 2013-03-06 01:04:01 +01:00
Justin Ruggles e951b6d94c vorbisdec: cosmetics: rename variable avccontext to avctx
This is consistent with the rest of libavcodec.
2013-02-25 15:15:21 -05:00
Luca Barbato 23bd9ef4b2 vorbisdec: Accept 0 amplitude_bits
The specification does not prevent an encoder to write the amplitude 0
as 0 amplitude_bits.

Our get_bits() implementation might not support a zero sized read
properly, thus the additional branch.
2013-02-25 07:34:00 +01:00
Luca Barbato 5b47c19bfd vorbisdec: Add missing checks
Rate and order must not be 0 even if the specification does not say that
explicitly.
2013-02-25 07:34:00 +01:00
Luca Barbato fc386f2eea vorbisdec: cosmetics
Use the commonly used "if (!var)" instead of "if (var == 0)".
2013-02-25 07:34:00 +01:00
Michael Niedermayer 11dcecfcca vorbisdec: Error on bark_map_size equal to 0.
The value is used to calculate output LSP curve and a division by zero
and out of array accesses would occur.

CVE-2013-0894

CC: libav-stable@libav.org

Reported-by: Dale Curtis <dalecurtis@chromium.org>
Found-by: inferno@chromium.org
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-02-25 07:33:59 +01:00
Justin Ruggles ee6ca11b65 vorbis: decode directly to the user-provided AVFrame 2013-02-12 12:22:39 -05:00
Ronald S. Bultje 1768e43ceb vorbisdsp: change block_size type from int to intptr_t.
This saves one instruction in the x86-64 assembly.
2013-01-20 22:26:42 -08:00
Ronald S. Bultje fef906c77c Move vorbis_inverse_coupling from dsputil to vorbisdspcontext.
Conveniently (together with Justin's earlier patches), this makes
our vorbis decoder entirely independent of dsputil.
2013-01-19 22:21:10 -08:00
Justin Ruggles e034cc6c60 lavc: Move vector_fmul_window to AVFloatDSPContext
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-01-16 10:45:45 +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 79b7747556 vorbisdec: use float planar sample format 2012-11-19 23:48:37 -05:00
Luca Barbato 714508bcb9 vorbisdec: ensure FASTDIV denominator is never 1
In both usages of FASTDIV the denominator might be 1.

Using a branch could make the function slower than using a normal
division.

Both denominator and numerator can be multiplied by 2 safely and
using shifts is faster than using a branch.
2012-09-14 14:26:27 +02:00
Mans Rullgard 4855022aa1 vorbisdec: remove some pointless comments
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-19 12:59:58 +01:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Mans Rullgard 9fcda25e35 vorbisdec: replace div/mod in loop with a counter
2x speedup of surround decoding on Cortex-A9.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-18 11:47:08 +01:00
Justin Ruggles d5a7229ba4 Add a float DSP framework to libavutil
Move vector_fmul() from DSPContext to AVFloatDSPContext.
2012-06-08 13:14:38 -04:00
Alex Converse ecf79c4d3e vorbis: Validate that the floor 1 X values contain no duplicates.
Duplicate values in this vector are explicitly banned by the Vorbis I spec
and cause divide-by-zero crashes later on.
2012-06-05 09:51:51 -07: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
Aaron Colwell 12623a8026 vorbisdec: avoid invalid memory access
This fixes some invalid memory access caused later in the function
by res_chan[] not being set for all channels. This happens when a
channel doesn't appear a submap. This change simply returns a
decoder error when this situation is detected.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-03-08 11:52:33 -08:00
Justin Ruggles 5602a464c9 avcodec: add a Vorbis parser to get packet duration
This also allows for removing some of the Vorbis-related hacks.
2012-03-03 16:43:11 -05:00
Justin Ruggles 737ca4482b vorbisdec: read the previous window flag for long windows
When reading sequentially, we are using the actual flag from the previous
frame, but when seeking we do not know what the previous window flag was, so
we need to read it from the bitstream.
2012-03-03 16:43:11 -05:00
Justin Ruggles 19adb0bc2d vorbisdec: add a flush() function
clear MDCT overlap buffer and reset previous window mode when seeking
2012-02-24 17:37:25 -05:00
Martin Storsjö 27cfdc3e4f vorbis: Add ff_ prefix to nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:07:11 +02:00
Martin Storsjö 9cf0841ef3 dsputil: Add ff_ prefix to the dsputil*_init* functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:06:34 +02:00
Martin Storsjö e96b4a53df vlc/rl: Add ff_ prefix to the nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:06:26 +02:00
Ronald S. Bultje 24947d4988 vorbis: fix overflows in floor1[] vector and inverse db table index. 2012-02-02 12:05:08 -08:00
Alex Converse 7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Chris Evans afb2aa5379 vorbis: An additional defense in the Vorbis codec.
Fixes Bug: #190
Chromium Bug: #100543
Related to CVE-2011-3893

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-01-08 09:09:26 +01:00
Reinhard Tartler e6d527ff72 vorbisdec: Fix decoding bug with channel handling
Fixes Bug: #191
Chromium Bug: #101458
CVE-2011-3895

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-01-07 23:16:52 +01:00
Diego Biurrun 3dc99a18d4 cosmetics: drop some pointless parentheses 2012-01-07 22:13:07 +01:00
Diego Biurrun aaf47bcde7 Drop ALT_ prefix from BITSTREAM_READER_LE name.
The prefix is a historic remnant that probably meant "alternative".
Now that the A32 bitstream reader has been dropped it makes no sense anymore.
2011-12-22 16:51:23 +01: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 41899b9acb vorbisdec: remove AVCODEC_MAX_AUDIO_FRAME_SIZE check
The user could provide a larger buffer, which is already checked separately
before writing output.
2011-11-10 10:25:46 -05:00
Justin Ruggles e551a6f49a vorbisdec: remove unneeded buf_size==0 check 2011-11-10 10:25:46 -05:00
Justin Ruggles f666276fa6 vorbisdec: return proper error codes instead of made-up ones 2011-11-10 10:25:46 -05:00
Justin Ruggles b95fbba705 cosmetics: remove extra spaces before end-of-statement semi-colons 2011-10-23 11:36:56 -04:00
Justin Ruggles 60aa1a358d vorbisdec: check output buffer size before writing output 2011-10-23 11:36:56 -04:00