Matt Wolenetz
b59b599446
lavc/vorbisdec: Allow avcodec_open2 to call .close
...
If there is a decoder initialization failure detected in avcodec_open2
after .init is called, allow graceful decoder .close to prevent leaking
vorbis decoder allocations such as those from vorbis_parse_setup_*.
BUG=772699
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
7 years ago
James Almer
8acd73e348
avcodec/vorbisdec: add missing comma
...
Should fix compilation failures after 191b2d4fc9
.
Found-by: philipl
8 years ago
Luca Barbato
73fc82f343
vlc: Add header #include when the types are used
...
Do not rely on indirectly including it from bitstream.h.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
8 years ago
Clément Bœsch
549045254c
Fix all -Wformat warnings raised by DJGPP
8 years ago
Diego Biurrun
0b77a59336
Use correct printf conversion specifiers for POSIX integer types
8 years ago
Diego Biurrun
b668662939
get_bits: Move BITSTREAM_READER_LE definition before all relevant #includes
...
This avoids the danger that get_bits.h might get indirectly #included before
BITSTREAM_READER_LE is defined.
Also sort headers into canonical order where appropriate.
9 years ago
Andreas Cadhalpun
e7a7b3135a
vorbisdec: reject rangebits 0 with non-0 partitions
...
This causes non-unique elements in floor_setup->data.t1.list, which
makes the stream undecodable according to the specification.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
9 years ago
Andreas Cadhalpun
b4b13848de
vorbisdec: reject channel mapping with less than two channels
...
It causes the angle channel number to equal the magnitude channel
number, which makes the stream undecodable according to the
specification.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
9 years ago
Paul B Mahol
81f7a2579b
avcodec/vorbisdec: use init_get_bits8()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Vittorio Giovara
def97856de
lavc: AV-prefix all codec capabilities
...
Express bitfields more simply.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
10 years ago
Vittorio Giovara
7c6eb0a1b7
lavc: AV-prefix all codec flags
...
Convert doxygen to multiline and express bitfields more simply.
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
10 years ago
Vittorio Giovara
6a85dfc830
lavc: Replace av_dlog and tprintf with internal macros
10 years ago
Luca Barbato
0025f7408a
vorbis: Check the vlc value in setup_classifs
...
The valid returned values are always at most 11bit.
Remove the previous check that assumed larger values plausible and
use a signed integer to check get_vlc2 return values.
CC: libav-stable@libav.org
10 years ago
Luca Barbato
62de77ffca
vorbis: Use a local codebook variable
...
Makes the code a little simpler.
10 years ago
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.
10 years ago
Michael Niedermayer
2234a1cd16
avcodec/vorbisdec: Fix memleak, call cleanup on memory allocation failure
...
Fixes CID1258478, CID1258476, CID1258475
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Vittorio Giovara
31dc73e92a
vorbisdec: Check memory allocations
10 years ago
Diego Biurrun
7f9f771eac
avcodec: Don't anonymously typedef structs
10 years ago
Michael Niedermayer
ad2deb02e5
avcodec/xiph: mark returned header pointers const from avpriv_split_xiph_headers()
...
Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
51f2422c2b
avcodec/vorbisdec: Use avpriv_float_dsp_alloc()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
b530e2e351
avcodec/vorbisdec: use av_freep(), do not leave stale pointers in memory
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
8c50704ebf
avcodec/vorbisdec: Fix off by 1 error in ptns_to_read
...
Fixes read of uninitialized memory
Fixes: asan_heap-uaf_18dac2b_9_asan_heap-uaf_22eb375_208_beta3_test_small.ogg
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
5a376976a0
avcodec/vorbisdec: Reset first_frame
...
This avoids returning a initial frame after seeking which does
not match what would be received when decoding from the begin.
Suggested-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
f0c78b0769
avcodec/vorbisdec: use av_malloc(z)_array()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
0a266cb55a
avcodec/vorbisdec: try to workaround libvorbisenc bug
...
Fixes Ticket3590
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
5171ae781a
avcodec/vorbisdec: use the stored previous window type only when the actual previous is not known
...
Fixes Ticket3432
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Diego Biurrun
b2bed9325d
cosmetics: Group .name and .long_name together in codec/format declarations
11 years ago
Michael Niedermayer
709cae2bcb
vorbisdec: Check VLC tables during use instead of setup
...
Fixes regression and Ticket2720
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
ae038c0914
vorbisdec: propagate errors from setup_classifs()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Luca Barbato
92b3caa108
vorbis: return meaningful errors
12 years ago
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.
12 years ago
Luca Barbato
ddf1b4a2f8
vorbis: simplify the inner loop in setup_classifs
12 years ago
Luca Barbato
36f1038004
vorbis: use normal integer values for iterators
...
No need to use fixed-size integers.
12 years ago
Luca Barbato
98186578a2
vorbis: refactor vorbis_residue_decode_internal
12 years ago
Michael Niedermayer
e6b6ae4695
vorbisdec: check codebook entry count
...
Fixes assertion failure
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Clément Bœsch
1ec94b0f06
lavc: factorize ff_{thread_,re,}get_buffer error messages.
...
Coccinelle profile used:
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_get_buffer(ctx, f, flags)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str;
@@
-if ((r = ff_reget_buffer(ctx, f)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_reget_buffer(ctx, f)) < 0)
+ return r;
@@
expression r, ctx, f, loglevel, str, flags;
@@
-if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0) {
- av_log(ctx, loglevel, str);
- return r;
-}
+if ((r = ff_thread_get_buffer(ctx, f, flags)) < 0)
+ return r;
...along with some manual patches for the remaining ones.
12 years ago
Hendrik Leppkes
cde1e7db3e
vorbis: unref the skipped first frame.
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Anton Khirnov
e2c2974120
vorbisdec: do not leak the first frame.
12 years ago
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
Luca Barbato
02055b6d40
vorbisdec: check memory allocations
12 years ago
Justin Ruggles
e951b6d94c
vorbisdec: cosmetics: rename variable avccontext to avctx
...
This is consistent with the rest of libavcodec.
12 years ago
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.
12 years ago
Luca Barbato
5b47c19bfd
vorbisdec: Add missing checks
...
Rate and order must not be 0 even if the specification does not say that
explicitly.
12 years ago
Luca Barbato
fc386f2eea
vorbisdec: cosmetics
...
Use the commonly used "if (!var)" instead of "if (var == 0)".
12 years ago
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>
12 years ago
Justin Ruggles
ee6ca11b65
vorbis: decode directly to the user-provided AVFrame
12 years ago
Ronald S. Bultje
1768e43ceb
vorbisdsp: change block_size type from int to intptr_t.
...
This saves one instruction in the x86-64 assembly.
12 years ago
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.
12 years ago
Justin Ruggles
e034cc6c60
lavc: Move vector_fmul_window to AVFloatDSPContext
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
e9ffee23f3
vorbisdec: handle midstream parameter changes
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago