Commit Graph

103 Commits

Author SHA1 Message Date
Even Rouault 4170681661
Add test cases for https://github.com/uclouvain/openjpeg/issues/1120 and https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2785 2018-06-20 15:28:53 +02:00
Even Rouault 98cfdd3134 opj_j2k_read_cod: remove check for 'No more than one COD marker per tile' (fixes #1043)
This check was added per daed8cc919
to fix https://github.com/uclouvain/openjpeg/issues/476 , but it does not seem
to be necessary with latest master (issue476.jp2 doesn't cause memory issues),
and breaks reading legit files.
2017-11-30 14:48:34 +01: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 4776b15fa7 Add test for fix of a55c024fc6 2017-08-28 18:08:13 +02:00
Even Rouault c059f431e6 Remove broken.jpc test from known failures, by avoiding too long processing time 2017-08-24 14:09:34 +02:00
Even Rouault fdcd4e6365 Remove -NR-DEC-p1_06.j2k-156-decode and NR-DEC-p1_06.j2k-164-decode from knownfailures
and make them explicit failures. The result images are empty at the requested resolution
2017-08-24 13:23:25 +02:00
Even Rouault afb308b9cc Encoder: grow buffer size in opj_tcd_code_block_enc_allocate_data() to avoid write heap buffer overflow in opj_mqc_flush (#982) 2017-08-14 17:20:37 +02:00
Even Rouault ac375ac9f5 Partial revert BPC related check of #975 (#979)
PR #975 introduced a check that rejects images that have different bit depth/sign
per compoment in SIZ marker if the JP2 IHDR box has BPC != 255
This didn't work properly if decoding a .j2k file since the new bit added in
opj_cp_t wasn't initialized to the right value.
For clarity, tThis new bit has also been renamed to allow_different_bit_depth_sign

But looking closer at the code, it seems we were already tolerant to inconsistencies.
For example we parsed a JP2 BPCC box even if BPC != 255 (just a warning is emitted)
So failing hard in opj_j2k_read_siz() wouldn't be very inconsistent, and that
alone cannot protect against other issues, so just emit a warning if BPC != 255
and the SIZ marker contains different bit depth/sign per component.

Note: we could also check that the content of JP2 BPCC box is consistant with the one
of the SIZ marker.
2017-08-09 11:34:08 +02:00
Even Rouault 73d1510d47 Encoder: fix packet writing of empty sub-bands (#891, #892)
There are situations where, given a tile size, at a resolution level,
there are sub-bands with x0==x1 or y0==y1, that consequently don't have any
valid codeblocks, but the other sub-bands may be non-empty.
Given that we recycle the memory from one tile to another one, those
ghost codeblocks might be non-0 and thus candidate for packet inclusion.
2017-06-12 18:37:50 +02:00
Even Rouault 81c5311758 T1: fix BYPASS/LAZY, TERMALL/RESTART and PTERM/ERTERM encoding modes. (#674)
There were a number of defects regarding when and how the termination of
passes had to done and the computation of their rate.
2017-06-09 10:49:03 +02:00
Even Rouault 2d2c368b19 Tests: test opj_compress in VSC mode (related to #172) 2017-05-23 14:31:39 +02:00
Matthieu Darbois fac916f72a Fix PNM file reading (#847)
Malformed PNM file could cause a crash in opj_compress.
Checks were added to prevent this.

Fixes #843
Updates #440
2016-09-22 00:30:34 +02:00
Matthieu Darbois 805972f4c8 Add test for issue 820 (#829)
Update uclouvain/openjpeg#820
2016-09-11 19:47:32 +02:00
Matthieu Darbois 45ed017b1b Add test for issue 826 (#827)
Update uclouvain/openjpeg#826

Also correct names for data of issue uclouvain/openjpeg#823
2016-09-08 23:56:06 +02:00
Matthieu Darbois e078172b1c Add sanity check for tile coordinates (#823)
Coordinates are casted from OPJ_UINT32 to OPJ_INT32
Add sanity check for negative values and upper bound becoming lower
than lower bound.
See also
https://pdfium.googlesource.com/pdfium/+/b6befb2ed2485a3805cddea86dc7574510178ea9
2016-09-08 00:24:15 +02:00
Matthieu Darbois acfb307df4 Add test for PR 818 (#822)
update uclouvain/openjpeg#818
2016-09-07 00:00:21 +02:00
mayeut 6609719b40 Correct expected result for test of issue 495 2016-05-08 20:26:12 +02:00
mayeut 1a8318f6c2 Fix Out-of-Bounds Access in function opj_tgt_reset
Fix uclouvain/openjpeg#775
2016-05-08 20:10:13 +02:00
mayeut 162f6199c0 Fix Heap Buffer Overflow in function color_cmyk_to_rgb
Fix uclouvain/openjpeg#774
2016-05-08 19:18:05 +02:00
mayeut 8f9cc62b3f Fix division by zero
Fix uclouvain/openjpeg#733
2016-05-08 18:40:12 +02:00
mayeut 4f11e89c80 Add tests for recent issues
Update uclouvain/openjpeg#725
Update uclouvain/openjpeg#726
2016-04-30 18:51:36 +02:00
mayeut 74e814358c Allow to write 3/5/7/9/11/13/15 bpp TIF files
Update uclouvain/openjpeg#729
2016-04-23 04:29:03 +02:00
mayeut 54393d9e38 Allow to read 3/5/7/9/11/13/15 bpp TIF files 2016-04-23 04:24:04 +02:00
mayeut fb4be3894e Fix undefined size jp2 box handling
Update #653
2015-11-07 01:35:43 +01: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 4cde646cd7 Add test for uclouvain/openjpeg#571 2015-09-10 01:24:46 +02:00
mayeut 2eb97a851d Update tests 2015-08-23 12:32:21 +02:00
mayeut a521472427 Add tests for CMYK/esYCC/CIELab 2015-08-21 21:41:50 +02:00
mayeut dc34a6cc8c Add test for #388 2015-07-31 01:48:51 +02:00
mayeut f3dad25c77 Update convert for PNG output
Update uclouvain/openjpeg#264
2015-07-26 18:28:03 +02:00
mayeut 96ae1b8dfc Add test for odd looking cmap & for cmap outside jp2h
Update uclouvain/openjpeg#235
2015-07-21 00:46:55 +02:00
mayeut 5bb074611a Update PNG support
Only input modified for now
Update uclouvain/openjpeg#536
Update uclouvain/openjpeg#264
2015-07-19 17:42:11 +02:00
mayeut 8048bbc7a2 Add tests for TIFF input with Alpha channel
Update uclouvain/openjpeg#322
2015-07-18 00:07:04 +02:00
mayeut d1591be3d7 Add tests for TIFF output
Update uclouvain/openjpeg#322
2015-07-17 23:22:40 +02:00
mayeut 6b7ad74e26 Add tests for TIFF input
Update uclouvain/openjpeg#322
2015-07-16 23:20:50 +02:00
Matthieu Darbois e3291c4e1f [trunk] Fix overflow in opj_image_comp_header_update (fixes issue 495) 2015-05-27 23:05:16 +00:00
Matthieu Darbois 757f9394bf [trunk] Add check for number of layers & cblkw/cblkh values (fixes issue 475) 2015-05-19 21:24:44 +00:00
Matthieu Darbois daed8cc919 [trunk] Add check for at most 1 COD marker per tile. 1 COD marker for MH (fixes issue 476) 2015-05-19 20:13:37 +00:00
Matthieu Darbois 59b844347c [trunk] fixed component precision upscaling in opj_decompress (fixes issue 458) 2014-12-22 15:50:32 +00:00
Matthieu Darbois 16240e21f9 [trunk] updated BMP format input support
Update  issue 203
2014-12-22 14:40:31 +00:00
Matthieu Darbois 33a0e66eb1 [trunk] updated BMP format input support
Update  issue 203
2014-12-22 13:14:37 +00:00
Matthieu Darbois f7ff08de5a [trunk] updated tests to get BMP RLE8 tested
Update  issue 203
2014-12-20 18:58:28 +00:00
Matthieu Darbois f1bae45c76 [trunk] fixed BMP reading for 8bpp when width & 3 == 1
Update  issue 203
2014-12-20 18:45:53 +00:00
Matthieu Darbois 65c07b42e3 [trunk] updated tests
Update  issue 415
2014-12-20 15:08:55 +00:00
Matthieu Darbois 3888daac6a [trunk] fixed test issues (fixes issue 454) 2014-12-20 13:27:30 +00:00
Matthieu Darbois dde788b59e [trunk] Updated checks regarding number of decomposition levels when compressing
Update  issue 215
2014-12-19 22:56:00 +00:00
Matthieu Darbois 58fc86452d [trunk] Fixed a crash on illegal tile offset when decoding
Update  issue 427
2014-12-18 22:56:38 +00:00
Matthieu Darbois c0cb119c0e [trunk] Fixed a crash on 0xh or wx0 image size decoding
Update  issue 427
2014-12-18 22:19:52 +00:00
Matthieu Darbois f095027329 [trunk] add test for compression using MCT with alpha channel
Update  issue 415
2014-12-09 19:45:12 +00:00
Matthieu Darbois 548aff34f4 [trunk] added check for tile component data size overflow (fixes issue 432) 2014-11-21 21:35:43 +00:00