Michael Niedermayer
fd54dd028b
jpeg2000: check len before parsing header
...
Avoid overread.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
17e5d614a8
jpeg2000: Check zero bit-plane validity
...
Prevent integer overflows.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Luca Barbato
7e201d575d
jpeg2000: Validate block lengthinc
...
Currently we are using an array with a static data size.
Similar to a patch with the same purpose by Michael Niedermayer.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
278a923c51
jpeg2000: Validate SIZ parsing
...
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
d3cb302b88
jpeg2000: Validate SOT parsing
...
Avoid some overreads.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
ac921338a4
jpeg2000: Correctly calculate sgnd
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
eae63e3c15
jpeg2000: Check component number in get_coc() and get_qcc()
...
Avoid overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Nicolas Bertrand <nicoinattendu@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
1a3598aae7
jpeg2000: Use bytestream2
...
Prevent a number of overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Luca Barbato
5efadcb8cd
jpeg2000: Clean up return paths and error messages
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Luca Barbato
be3271009e
jpeg2000: Define the maximum decomposition levels
...
And define the resolution levels according.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Michael Niedermayer
fbcc03db8f
jpeg2000: Check code-block size
...
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Signed-off-by: Nicolas Bertrand <nicoinattendu@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Luca Barbato
5650e331a7
jpeg2000: Validate resolution levels
...
There are 32 maximum decomposition levels, thus 33 resolution levels.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
12 years ago
Carl Eugen Hoyos
0915b531bc
Rename "AVClass class" as "AVClass component_class".
...
The aix header math.h defines "extern int class()" for C.
12 years ago
Michael Niedermayer
32fc8d6db6
avcodec/jpeg2000dec: check that tp_end is after the start
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
582f53349e
jpeg2000dec: make cblk->length(inc)/data use consistent
...
Fixes Ticket2612
Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
3b86174290
avcodec/jpeg2000dec: move bpno check to a earlier place
...
This prevents additional integer overflows
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
69e4d8e6a4
avcodec/jpeg2000dec: check len before parsing header
...
Fixes out of array read
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
5deb96c564
avcodec/jpeg2000dec: Check Psot
...
Fixes out of array read
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
e850a064ce
jpeg2000dec: Check compno in get_coc()
...
Fixes 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
129edcb50f
jpeg2000dec: dont set ncomponents to an invalid value
...
Fixes 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
8e887ca1fe
jpeg2000dec: Check bpno in decode_cblk()
...
Fixes integer overflow in fate-redcode-demux
Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
7c3a296b4f
jpeg2000dec: fix av_log()
...
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
21d0f75f29
jpeg2000dec: check that we have enough components for MCT
...
Fixes 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
c49d94487c
jpeg2000dec: Use the matching coding style struct for transform selection
...
Fixes a null pointer dereference
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
b26bcd08e6
jpeg2000dec: Check that theres a SOT before SOD
...
Fixes out of array access
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
c51654fbc0
jpeg2000dec: Support 4 tile parts
...
Fixes 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
c59ce1c98e
get_qcc: Check compno
...
Fixes 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
bbc19010ed
jpeg2000dec: return error for invalid cdxy values
...
Fixes division by 0
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
66c4d54413
jpeg2000dec: Propagate error code from get_cox() correctly
...
Without this the context state could become inconsistent
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
bbf43c70dd
jpeg2000dec: assert that curtileno is valid when used
...
Fixes CID1026755
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
6507d86f07
jpeg2000dec; optimize output sample convert a bit
...
67935 -> 29984 kcycles
Reviewed-by: Nicolas BERTRAND <nicoinattendu@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Paul B Mahol
d2021f74ed
jpeg2000dec: remove redundant error log message
...
Signed-off-by: Paul B Mahol <onemda@gmail.com>
12 years ago
Michael Niedermayer
9054e72529
jpeg2000: make sure s->numXtiles / s->numYtiles are reset when tile is deallocated
...
This keeps the structure fields more consistent after cleanup
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
dc60061bb6
jpeg2000dec: optimize dequantization_int()
...
4400->2800 cycles
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
6cbd0241f2
jpeg2000dec: optimize dequantization_float()
...
4700 -> 2700 cycles (sandybridge i7)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
f77467a11d
jpeg2000dec: fix indention
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
c1415cfefb
jpeg2000dec: print more detailed cdx/y debug info
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
9d56ccf5af
j2k/jpeg2000dec: merge
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
fd7e119037
jpeg2000dec: merge simplification of jpeg2000_decode_packets() from j2k
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
192050d7a7
jpeg2000dec: merge sgnd fix from j2k
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
5dbbb762e5
jpeg2000dec: merge struct field types from j2k
...
Fixes AVOption type mismatch
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
cdb86136f7
j2k/jpeg2000: merge some of the tilepart related code
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
f67f2681da
jpeg2000deci/j2kdec: fix sizeof types
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
20a2d5ec11
jpeg2000dec: fix ff_mqc_initdec() and data setup order
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
7a2b634220
jpeg2000dec: simplify init_tile() / merge from j2k
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
3f714d1ffd
jpeg2000/j2k: merge non functional changes
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
9ccc9f30f7
jpeg2000: drop red-blue swap
...
This should no longer be needed as the pix fmt was updated
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
310f9dd698
j2k/jpeg2000: merge pix_fmt setting code
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
8bedbb82ce
j2k/jpeg2000: split data pointer in int & float.
...
This fixes a TODO item and unifies both decoders structures
It also fixes undefined behavior due to aliasing violations
I choose 2 fields instead of a union because mistakely using the
wrong type with a union will lead to hard to debug "wrong output"
while with 2 fields mistakely using the wrong type will crash
with a null pointer derefernce which is much easier to debug
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago
Michael Niedermayer
83fd377c94
j2k/jpeg2000: merge float DWT and related code
...
the float conditions are largely changed to check the DWT
instead of the bitexact flag, which previously was wrong
(DWT53 is always int)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
12 years ago