Commit Graph

73 Commits

Author SHA1 Message Date
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>
2013-06-16 15:27:39 +02:00
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>
2013-06-14 19:34:00 +02:00
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>
2013-06-14 19:34:00 +02:00
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>
2013-06-14 01:55:43 +02:00
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>
2013-06-14 00:36:45 +02:00
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>
2013-06-10 17:13:46 +02:00
Michael Niedermayer
7c3a296b4f jpeg2000dec: fix av_log()
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-06 21:52:49 +02:00
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>
2013-06-06 16:06:48 +02:00
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>
2013-06-06 15:38:05 +02:00
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>
2013-06-06 10:51:07 +02:00
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>
2013-06-06 03:10:42 +02:00
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>
2013-06-06 02:26:22 +02:00
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>
2013-06-05 23:31:19 +02:00
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>
2013-06-05 18:34:07 +02:00
Michael Niedermayer
bbf43c70dd jpeg2000dec: assert that curtileno is valid when used
Fixes CID1026755
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-03 14:59:52 +02:00
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>
2013-06-03 13:00:50 +02:00
Paul B Mahol
d2021f74ed jpeg2000dec: remove redundant error log message
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-06-03 00:20:08 +00:00
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>
2013-06-01 14:41:46 +02:00
Michael Niedermayer
dc60061bb6 jpeg2000dec: optimize dequantization_int()
4400->2800 cycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-01 11:48:13 +02:00
Michael Niedermayer
6cbd0241f2 jpeg2000dec: optimize dequantization_float()
4700 -> 2700 cycles (sandybridge  i7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-01 11:48:09 +02:00
Michael Niedermayer
f77467a11d jpeg2000dec: fix indention
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 13:33:13 +02:00
Michael Niedermayer
c1415cfefb jpeg2000dec: print more detailed cdx/y debug info
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 13:32:33 +02:00
Michael Niedermayer
9d56ccf5af j2k/jpeg2000dec: merge
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 03:10:08 +02:00
Michael Niedermayer
fd7e119037 jpeg2000dec: merge simplification of jpeg2000_decode_packets() from j2k
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 03:10:08 +02:00
Michael Niedermayer
192050d7a7 jpeg2000dec: merge sgnd fix from j2k
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 03:10:07 +02:00
Michael Niedermayer
5dbbb762e5 jpeg2000dec: merge struct field types from j2k
Fixes AVOption type mismatch

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 03:10:07 +02:00
Michael Niedermayer
cdb86136f7 j2k/jpeg2000: merge some of the tilepart related code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 02:22:11 +02:00
Michael Niedermayer
f67f2681da jpeg2000deci/j2kdec: fix sizeof types
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 02:22:10 +02:00
Michael Niedermayer
20a2d5ec11 jpeg2000dec: fix ff_mqc_initdec() and data setup order
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 02:22:10 +02:00
Michael Niedermayer
7a2b634220 jpeg2000dec: simplify init_tile() / merge from j2k
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-31 02:22:10 +02:00
Michael Niedermayer
3f714d1ffd jpeg2000/j2k: merge non functional changes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-30 18:38:04 +02:00
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>
2013-05-30 18:37:56 +02:00
Michael Niedermayer
310f9dd698 j2k/jpeg2000: merge pix_fmt setting code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-30 16:45:30 +02:00
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>
2013-05-30 14:18:53 +02:00
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>
2013-05-29 00:29:25 +02:00
Michael Niedermayer
c37d735c1c jpeg2000dec: mct_decode: remove unused return
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-28 23:49:11 +02:00
Michael Niedermayer
fe7136ef82 j2k/jpeg2000: split stepsize in float & int variables
This is more clear and less prone to mistakes.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-28 22:16:14 +02:00
Michael Niedermayer
aa0d11ed0b jpeg2000dec: remove unneeded returns
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-28 22:16:14 +02:00
Michael Niedermayer
8cf57efdd7 j2k/jpeg2000: merge lowres code
This also fixes lowres use with ffplay

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-28 00:30:06 +02:00
Michael Niedermayer
8c2e201c4f j2k/jpeg2000: drop xi/yi0/1 from Jpeg2000Prec
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-27 15:53:42 +02:00
Michael Niedermayer
14652c080d j2k/jpeg2000: restructure cblk coord
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-27 15:13:18 +02:00
Michael Niedermayer
bd89b2b22a j2k/jpeg2000: log2_prec size cleanup
This also changes the cblk size storage method to what jpeg2000 uses

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-26 22:29:11 +02:00
Michael Niedermayer
cb39dfb870 j2k/jpeg2000: check cblk size
This is based on j2k FCD which is ambigous thus the limit
might be tighter.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-26 20:15:50 +02:00
Michael Niedermayer
de90bd6c3f j2k/jpeg2000: merge cosmetics and whitespace
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-26 20:15:50 +02:00
Michael Niedermayer
914ab4cd1c j2kdec & jpeg2000dec: check lengthinc against array size
Fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-22 04:18:38 +02:00
Michael Niedermayer
17e66c9ff4 j2k & jpeg2000dec: reset numX/Ytiles if tiles failed allocation
Fixes null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-22 03:18:55 +02:00
Michael Niedermayer
53f0442464 avcodec/jpeg2000dec: Port tile size check from j2kdec
Fixes potential integer overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-22 03:16:52 +02:00
Michael Niedermayer
73ffab4195 jpeg2000dec: check TPsot
Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-22 02:53:21 +02:00
Michael Niedermayer
fec8783883 jpeg2000dec: read and check curtileno
Fixes out of array accesses
Code ported from j2kdec

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-22 02:29:49 +02:00
Michael Niedermayer
f399b33c2b jpeg2000dec & j2kdec: Fix return type of get_sot()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-22 02:14:04 +02:00