summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/pi.c
AgeCommit message (Collapse)Author
2022-10-18Fix incorrect decoding of image with large number of progression levelsEven Rouault
Fixes regression introduced per d27ccf01c68a31ad62b33d2dc1ba2bb1eeaafe7b Fixes #1447
2021-12-05Fix some typos (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-08-30LGTM warning: Comparison result is always the sameDimitri Papadopoulos
Comparison is always true because pos >= 0.
2020-12-04pi.c: avoid out of bounds access with POC (fixes #1302)Even Rouault
2020-12-02pi.c: avoid out of bounds access with POC (refs ↵Even Rouault
https://github.com/uclouvain/openjpeg/issues/1293#issuecomment-737122836)
2020-04-21Add support for generation of PLT markers in encoderEven Rouault
* -PLT switch added to opj_compress * Add a opj_encoder_set_extra_options() function that accepts a PLT=YES option, and could be expanded later for other uses. ------- Testing with a Sentinel2 10m band, T36JTT_20160914T074612_B02.jp2, coming from S2A_MSIL1C_20160914T074612_N0204_R135_T36JTT_20160914T081456.SAFE Decompress it to TIFF: ``` opj_uncompress -i T36JTT_20160914T074612_B02.jp2 -o T36JTT_20160914T074612_B02.tif ``` Recompress it with similar parameters as original: ``` opj_compress -n 5 -c [256,256],[256,256],[256,256],[256,256],[256,256] -t 1024,1024 -PLT -i T36JTT_20160914T074612_B02.tif -o T36JTT_20160914T074612_B02_PLT.jp2 ``` Dump codestream detail with GDAL dump_jp2.py utility (https://github.com/OSGeo/gdal/blob/master/gdal/swig/python/samples/dump_jp2.py) ``` python dump_jp2.py T36JTT_20160914T074612_B02.jp2 > /tmp/dump_sentinel2_ori.txt python dump_jp2.py T36JTT_20160914T074612_B02_PLT.jp2 > /tmp/dump_sentinel2_openjpeg_plt.txt ``` The diff between both show very similar structure, and identical number of packets in PLT markers Now testing with Kakadu (KDU803_Demo_Apps_for_Linux-x86-64_200210) Full file decompression: ``` kdu_expand -i T36JTT_20160914T074612_B02_PLT.jp2 -o tmp.tif Consumed 121 tile-part(s) from a total of 121 tile(s). Consumed 80,318,806 codestream bytes (excluding any file format) = 5.329697 bits/pel. Processed using the multi-threaded environment, with 8 parallel threads of execution ``` Partial decompresson (presumably using PLT markers): ``` kdu_expand -i T36JTT_20160914T074612_B02.jp2 -o tmp.pgm -region "{0.5,0.5},{0.01,0.01}" kdu_expand -i T36JTT_20160914T074612_B02_PLT.jp2 -o tmp2.pgm -region "{0.5,0.5},{0.01,0.01}" diff tmp.pgm tmp2.pgm && echo "same !" ``` ------- Funded by ESA for S2-MPC project
2020-04-16Fix warnings about signed/unsigned casts in pi.cEven Rouault
2020-02-12Implement writing of IMF profilesEven Rouault
Add -IMF switch to opj_compress as well
2019-11-17pi.c: avoid integer overflow, resulting in later invalid access to memory in ↵Even Rouault
opj_t2_decode_packets(). Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18979
2018-11-28[OPENJP2] change the way to compute *p_tx0, *p_tx1, *p_ty0, *p_ty1 in functionYoung_X
opj_get_encoding_parameters Signed-off-by: Young_X <YangX92@hotmail.com>
2017-07-29Fix warnings in pi.c raised by VS11 analyze (#190)Even Rouault
2017-07-29opj_pi_update_decode_poc(): limit layno1 to the number of layers ↵Even Rouault
(CVE-2016-1626 and CVE-2016-1628, #850) This has been recently fixed in a less elegant way per 80818c39f5bfbac37768fcee95b0ffeceaa77264
2017-07-29opj_pi_next_pcrl(): avoid undefined shift behaviour. Fixes ↵Even Rouault
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2787. Credit to OSS Fuzz
2017-07-27opj_pi_next_rpcl / opj_pi_next_pcrl / opj_pi_next_cprl: avoid int overflow ↵Even Rouault
(#895) Fixes int overflow on openjeg-crashes-2017-07-27/id:000000,sig:08,src:000879,op:flip2,pos:128.jp2
2017-07-26Fix various undefined shift behaviour in pi.cEven Rouault
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2496 Credit to OSS Fuzz
2017-07-26Avoid division by zero in opj_pi_next_rpcl, opj_pi_next_pcrl, ↵Even Rouault
opj_pi_next_cprl (#938) Fixes crash on id_000004,sig_06,src_000679,op_arith8,pos_49,val_-17
2017-07-26Avoid index out of bounds access to pi->include[] (#938)Even Rouault
Fix id:000098,sig:11,src:005411,op:havoc,rep:2 test case
2017-07-26Avoid division by zero in opj_pi_next_rpcl, opj_pi_next_pcrl and ↵Even Rouault
opj_pi_next_cprl (#938) Fixes issues with id:000026,sig:08,src:002419,op:int32,pos:60,val:+32 and id:000019,sig:08,src:001098,op:flip1,pos:49
2017-05-09Reformat whole codebase with astyle.options (#128)Even Rouault
2016-09-15Add overflow checks for opj_aligned_malloc (#841)Matthieu Darbois
See https://pdfium.googlesource.com/pdfium/+/b20ab6c7acb3be1393461eb650ca8fa4660c937e/third_party/libopenjpeg20/0020-opj_aligned_malloc.patch
2016-09-08Cast to size_t before multiplicationMatthieu Darbois
Need to cast to size_t before multiplication otherwise overflow check is useless.
2016-09-06Fix an integer overflow issue (#809)trylab
Prevent an integer overflow issue in function opj_pi_create_decode of pi.c.
2016-04-28Fix unsigned int overflow reported by UBSan (#761)Matthieu Darbois
* Fix unsigned int overflow reported by UBSan Please add -DOPJ_UBSAN_BUILD to CFLAGS when building with -fsanitize=undefined,unsigned-integer-overflow It seems clang/gcc do not allow to disable checking for block of code other than function or file.
2016-01-06Fix duplicate article in commentsStefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-07-26Remove some warnings when buildingmayeut
Update #442
2015-07-18Add some missing staticmayeut
Still needs to check j2k.c & jp2.c Update uclouvain/openjpeg#243
2015-02-02[trunk] added overflow checks (fixes issue 431)Antonin Descampe
Thanks mdarbois
2015-01-15[trunk] fixed a buffer overflow in opj_tcd_init_decode_tileAntonin Descampe
Update issue 431
2014-10-01[trunk] fixed warning from r2891Antonin Descampe
2014-09-30[trunk] fixed bad use of case statement (fixes issue 381)Antonin Descampe
2014-09-16[trunk] improve memory management (fixes issue 359)Antonin Descampe
2014-04-17[trunk] refactoring of rsiz, profiles, and extensions managementAntonin Descampe
2014-04-03[trunk] updated copyright and added copyright notice required by ISO, in ↵Antonin Descampe
each file; updated AUTHORS, NEWS
2014-03-13[trunk] Add some documention in the pi codeMathieu Malaterre
2014-03-07[trunk] Another round of fixes for sign conversion warnings.Mathieu Malaterre
Update issue 256
2012-11-15[trunk] move opj_bool to OPJ_BOOL to follow the other typeMickael Savinaud
2012-11-15[trunk] rename public symbols with OPJ_ prefix (enum part)Mickael Savinaud
2012-11-15[trunk] rename public symbols with OPJ_ prefixMickael Savinaud
2012-11-13[trunk] remove warnings raised by flags -Wall -Wextra -pedanticMickael Savinaud
2012-11-13[trunk] remove warnings raised by flags -Wall -Wextra -pedantic and vs9 analyzerMickael Savinaud
2012-10-29[trunk] Fix remainings issues with doxygen docMathieu Malaterre
Convert DOS files to UNIX eol
2012-10-29[trunk] remove warnings related to the use of -Wall -Wextra -pedanticMickael Savinaud
2012-10-25[trunk] [trunk] remove old opj_tcp and rename opj_tcp_v2 to opj_tcpMickael Savinaud
2012-10-25[trunk] [trunk] remove old opj_cp and rename opj_cp_v2 to opj_cpMickael Savinaud
2012-10-15[trunk] Add missing newline characterMathieu Malaterre
2012-10-05[trunk] rename int.h to opj_intmath.h and rename all its functions with opj_ ↵Mickael Savinaud
prefix
2012-10-03[trunk]remove warnings in pi.c through the update of poc struct types with ↵Mickael Savinaud
new opj_types.
2012-10-03[trunk] (style) move global pi functions to the right place and update ↵Mickael Savinaud
indentation
2012-10-03[trunk] remove old v1 functions and rename pi_initialise_encode_v2 to ↵Mickael Savinaud
opj_pi_initialise_encode; pi_create_encode_v2 to opj_pi_create_decode; pi_destroy_v2 to opj_pi_destroy; pi_create_decode_v2 to opj_pi_create_decode
2012-10-03[trunk] update pi_check_next_level with the opj_ prefix and change output ↵Mickael Savinaud
type to be more convenient