Commit Graph

78 Commits

Author SHA1 Message Date
Robert Gabriel Jakabosky 883c31dbe0
Add support for partial bitstream decoding (#1407) (fixes #715)
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-02-10 14:27:17 +01:00
Eric Harvey a1eec9c49e
Fix unsigned vs OPJ_INT32 mismatches (#1398) 2022-01-16 18:54:00 +01:00
Eharve14 6e4588f379
Added check for integer overflow in get_num_images (#1397)
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-15 15:33:03 +01:00
Eharve14 1daaa0b909
Avoid overflow in multiplications in utilities related to big number of files in a directory (CVE-2021-29338) (#1396) 2022-01-13 21:05:52 +01:00
Brad Parham 79c7d7af59
opj_compress/opj_uncompress: fix integer overflow in num_images (#1395)
Includes the fix for CVE-2021-29338
Credit to @kaniini based on #1346
Fixes #1338
2022-01-12 13:46:10 +01:00
Stefan Weil 667149ffa1 Fix some typos (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-12-05 13:14:33 +01:00
Even Rouault 0b5d62684f
API: deprecate 'bpp' member in favor of 'prec'
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-10-21 14:13:58 +02:00
Even Rouault f3d8c763ba
opj_decompress / opj_dump: accept .jph and .jhc extensions for HTJ2K files 2021-09-25 12:26:59 +02:00
xiaoxiaoafeifei 0afbdcf3e6
Fix segfault in src/bin/jp2/opj_decompress.c due to uninitialized pointer (fixes #1368) (#1369) 2021-07-14 03:35:13 +02:00
Even Rouault f0629cb1c4
Fix various compiler warnings 2021-06-07 13:28:26 +02:00
Jamaika1 8aaafe6995
Import files tiff and yuv(raw) (#1316) 2021-05-06 19:30:34 +02:00
Even Rouault e8e258ab04
opj_decompress: fix double-free on input directory with mix of valid and invalid images (CVE-2020-15389)
Fixes #1261

Credits to @Ruia-ruia for reporting and analysis.
2020-06-30 21:31:19 +02:00
Sebastian Rasmussen b2751967ec openjp2/j2k: Report error if all wanted components are not decoded.
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.
2019-02-21 16:48:02 +08:00
Stefan Weil 948332e6ed Fix some potential overflow issues (#1161)
* Fix some potential overflow issues

Put sizeof to the beginning of the multiplication to enforce that
size_t instead of smaller integer types is used for the calculation.

This fixes warnings from LGTM:

    Multiplication result may overflow 'unsigned int'
    before it is converted to 'unsigned long'.

It also allows removing some type casts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>

* Fix code indentation

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-10-31 20:44:30 +01:00
Stefan Weil 3d6ffaf3f3 Fix some typos in code comments and documentation
All typos were found by Codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-05 20:01:10 +02:00
Even Rouault e8b6b54d1f opj_decompress -h: document -threads ALL_CPUS 2017-10-06 19:25:07 +02:00
Antonin Descampe d45ccb048b Merge pull request #1022 from rouault/partial_component_decoding
Add capability to decode only a subset of all components of an image.
2017-09-26 18:30:20 -03:00
Even Rouault 16b701659d opj_decompress: add a warning when -d and -t are used together (#693) 2017-09-20 01:06:02 +02:00
Even Rouault e17bbde906 opj_set_decoded_components(): add a provision for a apply_color_transforms parameter in case we support it in the future 2017-09-19 17:48:07 +02:00
Even Rouault 7e2b6bebff Add capability to decode only a subset of all components of an image.
This adds a opj_set_decoded_components(opj_codec_t *p_codec,
OPJ_UINT32 numcomps, const OPJ_UINT32* comps_indices) function,
and equivalent "opj_decompress -c compno[,compno]*" option.

When specified, neither the MCT transform nor JP2 channel transformations
will be applied.

Tests added for various combinations of whole image vs tiled-based decoding,
full or reduced resolution, use of decode area or not.
2017-09-19 17:06:19 +02:00
Even Rouault 8f92fc9791 Make opj_set_decode_area() and opj_decode() take into account opj_set_decoded_resolution_factor() (#1006, affect API use)
* Better document usage of opj_set_decode_area(), ie expecting coordinates
  in full resolution/reference grid even if requesting at a lower resolution
  factor
* Make sure that image->comps[].factor is set by opj_set_decode_area() and
  opj_decode() from the value specified in opj_set_decoded_resolution_factor()
* opj_decompress: add 2 environmenet variables to test alternate ways of
  using the API, namely USE_OPJ_SET_DECODED_RESOLUTION_FACTOR=YES to use
  opj_set_decoded_resolution_factor() instead of parameters.cp_reduce, and
  SKIP_OPJ_SET_DECODE_AREA=YES to not call opj_set_decode_area() if -d is
  not specified.
2017-08-28 14:57:49 +02:00
Even Rouault c38bdbef4f opj_decompress: document -quiet option, and remove spurious newline output 2017-08-09 10:03:59 +02:00
szukw000 00f45684a8 Catch images broken by AFL 2017-07-31 13:58:08 +02:00
Even Rouault 94cc97c58a opj_decompress: fix null pointer dereference on comps[].data on id_000167,sig_11,src_006079,op_havoc,rep_4 (#939) 2017-07-26 20:13:09 +02:00
Even Rouault 6026786069 Style fix 2017-06-21 13:20:35 +02:00
Even Rouault 93aca84731 Fix mingw related warnings 2017-06-21 12:54:40 +02:00
Even Rouault 5f596cb283 Fix warning about unused arguments 2017-06-17 14:10:15 +02:00
Russell McOrmond 5f1e380b51 Fixed formatting issues ASTYLE 2017-05-16 09:31:07 -04:00
Russell McOrmond 9d8e1ecdeb Quiet mode for opj_decompress via -quiet long parameter. 2017-05-15 14:39:54 -04:00
Even Rouault 563bd8499e Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
Matthieu Darbois 0954bc11e3 Fix some warnings (#838)
Fix warnings introduced by uclouvain/openjpeg#786
2016-09-14 00:12:43 +02:00
Even Rouault 69497d35c0 opj_decompress: use clock_gettime() instead of getrusage() so as to get the time spent, and not to the total CPU time 2016-05-25 21:59:43 +02:00
Even Rouault d67cd2220a opj_decompress: add a -threads <num_threads> option 2016-05-25 21:02:07 +02:00
julienmalik 319fc971fe cppcheck fix for openjp2 (#740) 2016-04-29 23:49:17 +02:00
Stefan Weil 93a61459cd opj_decompress: Update error message
The png format is also supported, so add it to the message.
Remove also the unneeded blank character before \n.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-01 21:01:20 +01:00
Stefan Weil c8ae3c5225 Fix warnings for C++
g++ complains about invalid conversions like these ones:

error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
error: invalid conversion from ‘void*’ to ‘opj_precision* {aka opj_prec*}’ [-fpermissive]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-07 20:53:57 +02:00
Stefan Weil 99fc1ab306 Fix typos in comments and string
Most typos were found by codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-09-29 05:55:43 +02:00
mayeut 838dfb8058 Provide safer string copy than strncpy
As per @boxerab suggestion in commit
b9ca882749
2015-09-25 22:04:58 +02:00
mayeut 4da7e9617f Fix resource leak 2015-09-25 00:39:05 +02:00
mayeut b9ca882749 Fix resource leaks & unchecked resource allocations 2015-09-25 00:08:34 +02:00
mayeut 49cbc11a19 Correct leak in color_cielab_to_rgb 2015-09-13 14:42:56 +02:00
mayeut f98df1c715 TIFF can output CMYK 2015-08-21 19:54:22 +02:00
szukw000 238f4419ab Defines three new functions
Declares three new functions
Calls the three new functions
Collects data for CIELab, sets the color_space for EYCC and CMYK
2015-07-30 23:31:12 +00:00
mayeut c423cc84e7 Remove some warnings when building
Update #442
2015-07-26 02:41:39 +02:00
mayeut ffd9db9700 Remove some warnings when building
Update #442
2015-07-25 03:16:16 +02:00
mayeut b190a91ab5 Remove some warnings when building
Update #442
2015-07-24 23:55:45 +02:00
mayeut dc43ebf96c Add option to force component splitting in imagetopnm
Update uclouvain/openjpeg#289
2015-07-11 11:35:21 +02:00
Aaron Boxer 6347686385 fixed a few bugs 2015-07-03 15:22:58 +02:00
Aaron Boxer 56d3f5af6e add timing to compress and decompress 2015-07-03 15:20:11 +02:00
Matthieu Darbois 73881d0e52 [trunk] Fix sscanf format specifier (fixes issue 494)
Thanks Aaron.
2015-05-28 22:16:49 +00:00