Michael Niedermayer
380659604f
avcodec/shorten: Move buffer allocation and offset init to end of read_header()
...
They are time consuming operations, performing them after the other checks
improves the speed with damaged input dramatically.
Fixes: Timeout
Fixes: 2928/clusterfuzz-testcase-4992812120539136
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>
7 years ago
Michael Niedermayer
e77ddd31a8
avcodec/shorten: Sanity check maxnlpc
...
Fixes OOM
Fixes: 2131/clusterfuzz-testcase-minimized-4718045157130240
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Michael Niedermayer
df8575584d
avcodec/shorten: Check residual size
...
Fixes assertion failure
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Michael Niedermayer
7b6a51f59c
avcodec/shorten: Check k in get_uint()
...
Fixes: undefined shift
Fixes: 1371/clusterfuzz-testcase-minimized-5770822591447040
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
8 years ago
Clément Bœsch
549045254c
Fix all -Wformat warnings raised by DJGPP
8 years ago
Paul B Mahol
20789372da
avcodec/shorten: support decoding AIFF-C variant
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
8 years ago
Alexandra Hájková
2b94ed12de
shorten: Convert to the new bitstream reader
8 years ago
Diego Biurrun
d4c2103bd3
golomb: Convert to the new bitstream reader
8 years ago
Diego Biurrun
67deba8a41
Use avpriv_report_missing_feature() where appropriate
8 years ago
Paul B Mahol
1f62a6e780
avcodec/shorten: make max frame size bigger if custom block size was used
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Paul B Mahol
b62ed56e25
avcodec/shorten: properly handle bitshift > 31
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Paul B Mahol
571aa7d25e
avcodec/shorten: mark as AV_CODEC_CAP_SUBFRAMES
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Paul B Mahol
0c90b2e013
avcodec/shorten: add support for AIFF packing, not bitexact
...
Also report unsupported packing.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Paul B Mahol
82ee37f1f3
avcodec/shorten: fix decoding of very large (>2048) block sizes
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Paul B Mahol
dee138624f
avcodec/shorten: fix decoding of files with number of samples lower than max_frame_size
...
Note that support of very big block sizes is not currently supported at all due
too flawed logic in decoder.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Paul B Mahol
c18fdc8692
avcodec/shorten: remove useless if condition and comment, reindent
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Paul B Mahol
966d43d778
avcodec/shorten: fix decoding of last frame
...
Previously it would be always discarded.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Paul B Mahol
ae8a13c560
avcodec/shorten: if allocation fails reset max_frame_size
...
Otherwise crash happens.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Paul B Mahol
0c9490609d
avformat: support shorten in nistshpere demuxer
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
9 years ago
Diego Biurrun
29c2d06d67
cosmetics: Drop empty comment lines
9 years ago
Vittorio Giovara
059a934806
lavc: Consistently prefix input buffer defines
...
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
10 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
Paul B Mahol
94cfb6db7d
avcodec/shorten: use init_get_bits8()
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
10 years ago
Michael Niedermayer
294469416d
avcodec/shorten: More complete pred_order check
...
Fixes CID1239055
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
2d15588124
avcodec/shorten: Fix code depending on signed overflow behavior
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
d201becfc0
avcodec/shorten: Check skip_bytes()
...
Fixes CID1210526
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
fbe8672e15
avcodec/shorten: use av_reallocp_array()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Vittorio Giovara
8e104619a6
shorten: check for return value
...
Avoid a possible negative bitshift.
CC: libav-stable@libav.org
Bug-Id: CID 1194400
10 years ago
Michael Niedermayer
e20ebe491c
avcodec/shorten: check bitshift
...
Fixes invalid shift
Fixes CID1194400
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
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
11 years ago
Michael Niedermayer
1486ed0815
avcodec/shorten: clear bitstream buffer
...
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f3ca95606fb_6393_luckynight-partial.shn
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Alexandra Khirnova
9b8d11a76a
avcodec: Use av_reallocp where suitable
...
Signed-off-by: Martin Storsjö <martin@martin.st>
11 years ago
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>
11 years ago
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
11 years ago
Diego Biurrun
b2bed9325d
cosmetics: Group .name and .long_name together in codec/format declarations
11 years ago
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>
11 years ago
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>
11 years ago
Michael Niedermayer
ad22767cb6
shorten: fix "off by padding" bug
...
Fixes array overread
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
89d998f1c1
shorten: allocate space for padding
...
Fixes array overread
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
Luca Barbato
4c364eb2b8
shorten: report meaningful errors
12 years ago
Luca Barbato
a2ad554def
shorten: K&R formatting cosmetics
12 years ago
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.
12 years ago
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>
12 years ago
Michael Niedermayer
a5153b1d16
shorten: Fix signedness of comparission
...
Fixes out of array accessed
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
4f1279154e
shorten: dont leave invalid channel counts in the context.
...
Fixes freeing invalid addresses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Justin Ruggles
fed74c0ae4
shorten: decode directly to the user-provided AVFrame
12 years ago
Luca Barbato
4839fbe2d1
shorten: fix array subscript is below array bounds warning
...
Incidentally fixes alpha builds.
12 years ago
Diego Biurrun
511cf612ac
miscellaneous typo fixes
12 years ago