summaryrefslogtreecommitdiff
path: root/src/bin
AgeCommit message (Collapse)Author
2024-02-29Fix line endings (CRLF -> LF)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2024-02-28Fix some typos (found by `codespell` and `typos`)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2024-02-18Merge pull request #1509 from rouault/fix_sycc420_to_rgbEven Rouault
opj_decompress: fix off-by-one read heap-buffer-overflow in sycc420_to_rgb() when x0 and y0 are odd (CVE-2021-3575, fixes #1347)
2024-02-18opj_decompress: fix off-by-one read heap-buffer-overflow in sycc420_to_rgb() ↵Even Rouault
when x0 and y0 are odd (CVE-2021-3575, fixes #1347)
2024-01-08CMake: drop support for cmake < 3.5Dominik Wójt
Compatibility for cmake version < 3.5 is now deprecated in cmake and specifing version below 3.5 in cmake_minimum_required produces a warning.[1] [1] https://cmake.org/cmake/help/latest/release/3.27.html#deprecated-and-removed-features
2023-09-24Require `stdint.h` & `inttypes.h`mayeut
With #1450 which goes with 480cc9d49775d018c19ce0e01f6be27858d63d39 "Remove support for non-C99 compilers (like VS2010) that don't support snprintf()", support for MSVC versions prior to vs2015 is dropped: https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 This means that all supported MSVC versions do have `stdint.h` & `inttypes.h` now. For non windows platforms, those headers were already mandatory. Make them mandatory for all builds.
2023-03-09CMake: error out on warnings for strict/missing prototypes.Sebastian Rasmussen
And fix strict-prototypes/missing-prototypes warnings.
2022-08-11Cleanup code related to quality layer allocation, and add a few safety checksEven Rouault
2022-08-07CMake: switch to GNUInstallDirs (#1424)Thomas Bracht Laumann Jespersen
* Add GNUInstallDirs for standard installation directories Distributions are given standard variables for already existing hooks. Multiarch libdirs is taken care of automagically. Raises minimum cmake version by a little. * Handle CMAKE_INSTALL_xxx being absolute paths for .pc file generation In some cases the CMAKE_INSTAL_{BIN,MAN,DOC,LIB,INCLUDE}DIR variables may turn out to be absolute paths in which case prepending ${prefix} in the pkg-config .pc files will result in incorrect values. For .pc file generation, figure out if these variables are absolute and omit the prefix in the configured file when so. See: https://github.com/OSGeo/PROJ/commit/ab25e4b7ed9544e668282dcd293cfaaa2e56dbdf
2022-05-08opj_compress.c: usage formatting fixEven Rouault
2022-05-06JAVA_SOURCE_VERSION from 1.6 to 1.8Pei Jia
2022-02-10Add support for partial bitstream decoding (#1407) (fixes #715)Robert Gabriel Jakabosky
Add a -allow-partial option to opj_decompress utility and a opj_decoder_set_strict_mode() option to the API Co-authored-by: Chris Hafey <chafey@gmail.com>
2022-01-23opj_encoder_set_extra_options(): add a GUARD_BITS=value optionEven Rouault
and add a -GuardBits option to opj_compress. The recently-released SMPTE DCP Bv2.1 Application Profile (link below) says that the number of guard bits in the QCD marker shall be 1 for 2K content and 2 for 4K content. This change allows the number of guard bits to be configured, so that users of openjpeg have the control they need to meet the specification. https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=9161348 This is an alternative implementation of https://github.com/uclouvain/openjpeg/pull/1388 that keeps ABI unchanged.
2022-01-16Fix unsigned vs OPJ_INT32 mismatches (#1398)Eric Harvey
2022-01-15Added check for integer overflow in get_num_images (#1397)Eharve14
As discussed in pull request 1396, added a check for integer overflow. Change list: Defined num_images as unsigned int Moved the if statement to check for an empty directory to the beginning of the read directory section Added a check to see if num images would roll back to zero when incrementing.
2022-01-13Avoid overflow in multiplications in utilities related to big number of ↵Eharve14
files in a directory (CVE-2021-29338) (#1396)
2022-01-12opj_compress/opj_uncompress: fix integer overflow in num_images (#1395)Brad Parham
Includes the fix for CVE-2021-29338 Credit to @kaniini based on #1346 Fixes #1338
2021-12-10Remove duplicate assignments in function tiftoimageStefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-12-05Format source file with typo fixesStefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-12-05Fix some typos (found by codespell)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-10-27opj_compress: add a -TargetBitDepth switch for TIFF output (#1384)msheby
Sometimes, given the same (16-bit TIF) input, one wants to generate a variety of J2C outputs (say, 16-, 12-, and 10-bit). This patch allows one to downsample input files, and so makes it easier to automate OpenJPEG in mass generation of J2Cs without having to pipe though an image processing program.
2021-10-21API: deprecate 'bpp' member in favor of 'prec'Even Rouault
in opj_image_comp and opj_image_comptparm structures. bpp was redundant with prec, and almost never set by the library, except by opj_image_create(). This change should hopefully not impact existing, working, users of the API, which should already have used prec to get things working. Fixes #1379
2021-09-26opj_dump.c: fix potential buffer overflowEven Rouault
2021-09-25opj_decompress / opj_dump: accept .jph and .jhc extensions for HTJ2K filesEven Rouault
2021-09-12Use standard integer types for compatibility with libtiff 4.3.0 (#1377)Jamaika1
2021-08-12A couple typos found by codespellDimitri Papadopoulos
2021-07-14Fix segfault in src/bin/jp2/opj_decompress.c due to uninitialized pointer ↵xiaoxiaoafeifei
(fixes #1368) (#1369)
2021-06-07Add support for enabling generation of TLM markers in encoderEven Rouault
Support was already there, but restricted to Cinema and IMF profiles, and 255 tiles * Add -TLM switch added to opj_compress * Make opj_encoder_set_extra_options() function accept a TLM=YES option.
2021-06-07Fix various compiler warningsEven Rouault
2021-05-06Import files tiff and yuv(raw) (#1316)Jamaika1
2021-05-04Remove obsolete components JPWL, JP3D and MJ2Even Rouault
2020-11-30pngtoimage(): fix wrong computation of x1,y1 if -d option is used, that ↵Even Rouault
would result in a heap buffer overflow (fixes #1284)
2020-10-09Merge pull request #1253 from rouault/floating_point_irreversible_encodingEven Rouault
Single-threaded performance improvements in forward DWT for 5-3 and 9-7 (and other improvements)
2020-09-23Bump Java compatibility from 1.5 to 1.6 (#1263)Pei JIA
2020-06-30opj_decompress: fix double-free on input directory with mix of valid and ↵Even Rouault
invalid images (CVE-2020-15389) Fixes #1261 Credits to @Ruia-ruia for reporting and analysis.
2020-05-20Add multithreading support in the T1 (entropy phase) encoderEven Rouault
- API wise, opj_codec_set_threads() can be used on the encoding side - opj_compress has a -threads switch similar to opj_uncompress
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-17color_apply_icc_profile: add checks on the number of components (#1236)szukw000
2020-04-17jp3d/jpwl/mj2/jpip: Fix resource leaks (#1226)Eduardo Barretto
This issues were found by cppcheck and coverity.
2020-04-01opj_decompress: add sanity checks to avoid segfault in case of decoding errorEven Rouault
Prevent crashes like: opj_decompress -i 0722_5-1_2019.jp2 -o out.ppm -r 4 -t 0 where 0722_5-1_2019.jp2 is https://drive.google.com/file/d/1ZxOUZg2-FKjYwa257VFLMpTXRWxEoP0a/view?usp=sharing
2020-02-13opj_compress: improve help message regarding new IMF switchEven Rouault
2020-02-12Implement writing of IMF profilesEven Rouault
Add -IMF switch to opj_compress as well
2019-11-17JPWL: convert: Fix buffer overflow reading an image file less than four ↵Robert Ancell
characters (#1196) Fixes #1068
2019-09-03Merge pull request #1164 from sebras/masterEven Rouault
openjp2/j2k: Report error if all wanted components are not decoded.
2019-04-15bmp_read_rle4_data(): avoid potential infinite loopYoung Xiao
2019-04-15convertbmp: detect invalid file dimensions earlyYoung Xiao
width/length dimensions read from bmp headers are not necessarily valid. For instance they may have been maliciously set to very large values with the intention to cause DoS (large memory allocation, stack overflow). In these cases we want to detect the invalid size as early as possible. This commit introduces a counter which verifies that the number of written bytes corresponds to the advertized width/length. See commit 8ee335227bbc for details. Signed-off-by: Young Xiao <YangX92@hotmail.com>
2019-03-29Revert "[JPWL] tgatoimage(): avoid excessive memory allocation attempt,"Even Rouault
This reverts commit 05be3084460e46282ee63f04c72c451f3271fd28. This commit doesn't compile due to missing OPJ_UINT64 type
2019-02-21openjp2/j2k: Report error if all wanted components are not decoded.Sebastian Rasmussen
Previously the caller had to check whether each component data had been decoded. This means duplicating the checking in every user of openjpeg which is unnecessary. If the caller wantes to decode all or a set of, or a specific component then openjpeg ought to error out if it was unable to do so. Fixes #1158.
2018-12-14convertbmp: detect invalid file dimensions earlyHugo Lefeuvre
width/length dimensions read from bmp headers are not necessarily valid. For instance they may have been maliciously set to very large values with the intention to cause DoS (large memory allocation, stack overflow). In these cases we want to detect the invalid size as early as possible. This commit introduces a counter which verifies that the number of written bytes corresponds to the advertized width/length. Fixes #1059 (CVE-2018-6616).
2018-12-07Merge pull request #1168 from Young-X/fix_devEven Rouault
Fix multiple potential vulnerabilities and bugs