Commit Graph

84 Commits

Author SHA1 Message Date
Even Rouault 09e83407fa Avoid asserting on assert(i == pcol) in opj_jp2_apply_pclr() by adding new check in opj_jp2_check_color(). Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3068. Credit to OSS Fuzz 2017-08-17 11:05:53 +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
Antonin Descampe 0394f8d0f1 Merge pull request #975 from szukw000/changes-for-afl-tests
Catch images broken by AFL
2017-08-08 16:51:54 -07:00
Even Rouault 434ace4ff7 opj_jp2_apply_pclr() also needs to use opj_image_data_alloc/opj_image_data_free 2017-08-07 18:32:52 +02:00
szukw000 57e36dbfeb First change on changes-for-afl-tests 2017-08-02 17:27:08 +02:00
szukw000 00f45684a8 Catch images broken by AFL 2017-07-31 13:58:08 +02:00
Even Rouault ffa9a4f658 Fix warnings in USE_JPIP compilation mode 2017-07-30 18:46:34 +02:00
Even Rouault 83342f2aaf Fix Doxygen warnings (patch derived from Winfried's doxygen-dif.txt.zip, #849) 2017-07-30 18:18:59 +02:00
Even Rouault e23e0c94d0 Avoid p_stream->m_user_data_length >= (OPJ_UINT64)p_stream->m_byte_offset assertion in opj_stream_get_number_byte_left(). Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2786. Credit to OSS Fuzz 2017-07-30 16:48:15 +02:00
Even Rouault 7bdbe490cb Fix null pointer dereference in opj_jp2_apply_pclr(). Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2558. Credit to OSS Fuzz 2017-07-28 21:55:22 +02:00
Even Rouault 178194c093 opj_jp2_check_color(): replace assertion regarding mtyp by runtime check (#672, #895)
Fixes test case openjeg-crashes-2017-07-27/id:000000,sig:06,src:000001,op:flip1,pos:808.jp2
of #895
2017-07-27 18:52:35 +02:00
Even Rouault 5e795d90a1 Spelling fixes (patch by ka7, #890, rebased on top of master) 2017-07-26 21:06:38 +02:00
Even Rouault a8ca7c51f3 CMake: add stronger warnings for openjp2 lib/bin by default, and error out on declaration-after-statement
And remove occurences of unused arguments in src/lib/openjp2
2017-05-23 15:47:57 +02:00
Even Rouault 563bd8499e Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
Even Rouault 48c16b2c19 Merge branch 'master' of https://github.com/uclouvain/openjpeg into tier1_optimizations_multithreading_2
Conflicts:
	src/lib/openjp2/t1.c
2016-09-08 10:30:09 +02:00
Matthieu Darbois d7e6b7de8a Fix leak & invalid behavior of opj_jp2_read_ihdr (#818)
In case multiple ihdr box are present, only the first one shall be
taken into account.
2016-09-06 01:31:15 +02:00
Even Rouault d4b7f03cfa Add opj_codec_set_threads() in public API and propagate resulting thread pool to tcd level
By default, only the main thread is used. If opj_codec_set_threads() is not used,
but the OPJ_NUM_THREADS environment variable is set, its value will be
used to initialize the number of threads. The value can be either an integer
number, or "ALL_CPUS". If OPJ_NUM_THREADS is set and this function is called,
this function will override the behaviour of the environment variable.
2016-05-25 21:02:07 +02:00
julienmalik 319fc971fe cppcheck fix for openjp2 (#740) 2016-04-29 23:49:17 +02:00
mayeut fb4be3894e Fix undefined size jp2 box handling
Update #653
2015-11-07 01:35:43 +01:00
Stefan Weil 9f78c68953 Fix typo in comments
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-29 20:37:27 +01:00
Stephan Mühlstrasser d6b51b7041 Added missing casts for return values of opj_malloc()/opj_calloc(). 2015-10-06 15:33:46 +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 fa9142b7e4 Fix formatting 2015-08-21 20:15:50 +02:00
Matthieu Darbois 3109759fd7 Merge pull request #559 from szukw000/cmyk-cielab-esycc
Add support for CIELab, EYCC and CMYK
2015-08-21 19:48:31 +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 0df90afdf7 Remove printf/fprintf to stdout/stderr throughout openjp2 lib
Update uclouvain/openjpeg#246
2015-07-30 23:26:31 +02:00
mayeut a56819eaab Add some missing static keywords
Update uclouvain/openjpeg#243
2015-07-23 07:48:42 +02:00
mayeut 775ee87776 Add checks for odd looking cmap & for cmap outside jp2h box
Update uclouvain/openjpeg#235
Update uclouvain/openjpeg#447
2015-07-12 19:39:30 +02:00
Antonin Descampe 4c0ed02806 [trunk] checks for JP2 signature and file type boxes more carefully
Update issue 430
2015-01-20 14:27:20 +00:00
Matthieu Darbois bde5ba6ae8 [trunk] fixed compression check for 1 bit unsigned component (fixes issue 457) 2014-12-22 15:00:12 +00:00
Matthieu Darbois 04c6bb4a72 [trunk] removed warnings when building jp2.c (Update issue 442) 2014-11-24 21:31:09 +00:00
Matthieu Darbois 8397eac382 [trunk] added check for pclr box validity (fixes issue 429) 2014-11-20 23:47:09 +00:00
Matthieu Darbois f57f59b10d [trunk] remove warning during build (fixes issue 435) 2014-11-18 18:30:44 +00:00
Matthieu Darbois f123ce8f8a [trunk] fixed a bug preventing palette image with cdef to decode properly using opj_get_decoded_tile (fixes issue 428) 2014-11-17 21:46:43 +00:00
Antonin Descampe cf5153c518 [trunk] add a cdef box when alpha component is present (fixes issue 416) 2014-11-03 14:12:01 +00:00
Antonin Descampe 3b7dced8e6 [trunk] fixed a bug preventing palette image with cdef to decode properly (fixes issue 412) 2014-10-30 18:26:10 +00:00
Antonin Descampe 03a410e03d [trunk] fixed a bug that was preventing image with per channel alpha to decode properly (fixes issue 414) 2014-10-30 18:26:04 +00:00
Antonin Descampe 0a3f234df7 [trunk] verify channel definitions is complete when cdef is present (fixes issue 397) 2014-10-21 12:54:08 +00:00
Antonin Descampe e65303b903 [trunk] added check on JP2_IHDR box (fixes issue 364) 2014-10-21 12:35:16 +00:00
Antonin Descampe eb7c6d295a [trunk] fixed potential negative size params (fixes issue 390) 2014-10-06 21:05:32 +00:00
Antonin Descampe f126eb0d41 [trunk] added box length inconsistency check
Update issue 364

issue364-38.patch applied. Thanks Matthieu.
2014-10-06 21:05:27 +00:00
Antonin Descampe 7256e43c48 [trunk] fixed PDF crash in Chrome (fixes issue 362) 2014-10-06 21:05:21 +00:00
Antonin Descampe a0a3af1dee [trunk] removed illegal character in comment 2014-10-03 19:52:20 +00:00
Antonin Descampe 6868ee373e added memory allocation checks (fixes issue 355) 2014-09-19 10:26:35 +00:00
Antonin Descampe 50a205d20f [trunk] improve memory management (fixes issue 359) 2014-09-16 15:48:04 +00:00
Antonin Descampe d19a4ab676 [trunk] updated copyright and added copyright notice required by ISO, in each file; updated AUTHORS, NEWS 2014-04-03 15:30:57 +00:00
Mathieu Malaterre 15863e7170 [trunk] rework code from r2463. Really there has been some code duplication from r2413
Thanks to John Rogers (oracle.com) for report
2014-03-14 15:06:20 +00:00
Mathieu Malaterre 5e91877636 [trunk] rework code from r2463. Really there has been some code duplication from r2413
Thanks to John Rogers (oracle.com) for report
2014-03-14 15:04:24 +00:00
Mathieu Malaterre 5dd770746b [trunk] Fix remainings warnings on linux/32bits arch 2014-03-11 10:28:04 +00:00
Mathieu Malaterre ffad2fbe55 [trunk] Another round of fixes for sign conversion warnings.
Update issue 256
2014-03-07 14:14:31 +00:00