Andreas Cadhalpun
d0eff8857c
wavpack: limit extra_bits to 32 and use get_bits_long
...
More than 32 bits can't be stored in an integer and get_bits should not
be used with more than 25 bits.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
10 years ago
Andreas Cadhalpun
f9883a669c
wavpack: use get_bits_long to read up to 32 bits
...
get_bits should not be used for more than 25 bits.
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
10 years ago
Michael Niedermayer
042260cde4
avcodec/wavpack: Check L/R values before use to avoid harmless integer overflow and undefined behavior in fate
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Christophe Gisquet
a59f85d106
wavpack: check number of channels
...
This means container and codec disagree. The codec is supposed to
know better so this could be an error instead.
10 years ago
Christophe Gisquet
11a39bdf53
wavpack: report if there is no bits left
...
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
28bf111503
avcodec/wavpack: fix () in macros
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
326463893b
avcodec/wavpack: initialize pointers to silence warning about them possibly being uninitialized
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
95953c1cfd
avcodec/wavpack fix *void pointer arithmetic
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
866c44d4b0
avcodec/wavpack: clear remainder of data in case of error in wv_unpack_mono/stereo()
...
Fixes use of uninitialized data
Fixes: msan_uninit-mem_7fd85b654950_4005_because.wv
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Paul B Mahol
82e576046c
avcodec/wavpack: use init_get_bits8()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
11 years ago
Anton Khirnov
23a211cbba
lavc: change all decoders to behave consistently with AV_EF_CRCCHECK.
...
Just crccheck prints a warning, crccheck+explode returns an error.
Also document this behavior.
11 years ago
Diego Biurrun
b2bed9325d
cosmetics: Group .name and .long_name together in codec/format declarations
11 years ago
Paul B Mahol
93f4277714
WavPack encoder
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
ff0bdf9375
lavc: copy AVCodecContext for threads
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
b94f045b18
wavpack: add missing .\n to entropy error message
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
9684d7f1a2
wavpack: frame multi-threading support
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Paul B Mahol
a44d39ae42
wavpack: remove redundant error log message
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Anton Khirnov
89806691b1
wavpack: check that all the channels were coded.
12 years ago
Anton Khirnov
eae1b8451a
wavpack: check that there aren't too many blocks per packet
12 years ago
Anton Khirnov
7d039e70a5
wavpack: extract channel information from the bitstream
...
This way we don't require the caller to parse the block header. It also
allows the channel configuration to change mid-stream.
12 years ago
Anton Khirnov
78f75b6fa4
wavpack: extract sample rate from the bitstream
...
This way we don't require the caller to parse the block header. It also
allows the sample rate to change mid-stream.
12 years ago
Michael Niedermayer
107e9e4432
wavpack: Properly check channel index, dont write out of arrays
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Anton Khirnov
9b6f47c448
matroskadec: export full wavpack blocks.
...
This allows us to get rid of demuxer-specific hacks in the decoder and
will allow streamcopy from matroska once we have a wavpack muxer.
12 years ago
Anton Khirnov
5074f4545c
wavpack demuxer: export full wavpack blocks.
...
Currently the demuxer shaves the blocks and exports only the
information that is useful to the decoder.
Exporting the blocks just as they are stored is simpler to understand
and will make remuxing wavpack easier.
12 years ago
Anton Khirnov
72dee5f40b
wavpack: don't set sample format in init.
...
We don't know whether it will be float until we look at the data.
12 years ago
Anton Khirnov
35596bd4f4
wavpack: remove a useless parameter from wavpack_decode_block().
...
The decoder always returns output if an error does not occur.
12 years ago
Anton Khirnov
d1bec4be22
wavpack: return an error on 0-sized blocks
...
Such blocks are not valid.
12 years ago
Anton Khirnov
1d177200ce
wavpack: remove a useless check.
...
Number of samples in the first block is checked to be strictly positive
earlier in wavpack_decode_frame() and number of samples in all the other
blocks is checked to be equal to the first one.
12 years ago
Anton Khirnov
0f3a0b24dd
wavpack: add an error message to a failure.
12 years ago
Anton Khirnov
474fb0c9d9
wavpack: return 0 instead of samples count from decoding functions
...
The caller never cares about the number of decoded samples, so this only
confuses the reader.
12 years ago
Anton Khirnov
528daa3990
wavpack: switch to planar output
...
This simplifies the code and makes it faster.
12 years ago
Anton Khirnov
a7ec3a9a4e
wavpack: drop redundant if/else blocks
12 years ago
Anton Khirnov
7b44c99180
wavpack: remove the subframes codec cap
...
The decoder always consumes full packets.
12 years ago
Michael Niedermayer
ac2c52174f
avcodec/wavpack: remove ;;
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Luca Barbato
fd06291239
wavpack: check packet size early
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
3f0b6d7a62
wavpack: use bytestream2 in wavpack_decode_block
...
Prevent most out of buffer reads.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
ed50673066
wavpack: validate samples size parsed in wavpack_decode_block
...
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
12 years ago
Luca Barbato
8c34558131
wavpack: return meaningful errors
...
And forward those that were already meaningful.
12 years ago
Luca Barbato
0f689a3d97
wavpack: K&R formatting cosmetics
...
Signed-off-by: Diego Biurrun <diego@biurrun.de>
12 years ago
Michael Niedermayer
c6831e2a70
wavpack: check K, fix assertion failure
...
Instead of this it would be possible to change the code to support
larger K but that would make the code slower and probably still need
checks on K.
This variant is choosen as there are no known valid files that need
larger K
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
Anton Khirnov
759001c534
lavc decoders: work with refcounted frames.
12 years ago
Justin Ruggles
9873d71f31
wavpack: decode directly to the user-provided AVFrame
12 years ago
Michael Niedermayer
8d06be6b8c
wavpack: check pointer to avoid overreading input buffer
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Anton Khirnov
594d4d5df3
lavc: add a wrapper for AVCodecContext.get_buffer().
...
It will be useful in the upcoming transition to refcounted AVFrames.
12 years ago
Michael Niedermayer
d8a1eb11b7
wavpack: check the blocks sample count, fix out of array accesses
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
580021cfc4
wavpack: check ch_offset
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
be818df547
wavpack: fix out of array access
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Justin Ruggles
a903f8f087
Include libavutil/channel_layout.h instead of libavutil/audioconvert.h
...
Also reorder some other #include when applicable.
12 years ago
Paul B Mahol
4744f67d4f
wavpack: check if number of samples is not too big
...
Wavpack format documentation mentions that 131072 is
max number of samples.
This fixes huge memory allocations in sample from ticket #1889 .
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago