Commit Graph

679 Commits

Author SHA1 Message Date
Mathieu Malaterre ac927f2eee OPENJPEG_NAMESPACE is configurable by user 2016-09-26 12:02:22 +02:00
Mathieu Malaterre 1be0128fab Remove typos from comments and man pages 2016-09-26 11:28:44 +02:00
Matthieu Darbois f053508f6f 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 08:16:36 +02:00
Stefan Weil 7a5fb35b8d Fix some issues reported by Coverity Scan (#846)
* test_tile_decoder: Fix potential buffer overflow (coverity)

CID 1190155 (#1 of 1): Unbounded source buffer (STRING_SIZE)

Using a pointer instead of buffer of fixed size avoids the limit
for the length of the input file name.

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

* test_tile_encoder: Fix potential buffer overflow (coverity)

CID 1190154 (#1 of 1): Unbounded source buffer (STRING_SIZE)

Using a pointer instead of buffer of fixed size avoids the limit
for the length of the output file name. This implies that the length
can exceed 255, so the data type for variable len had to be fixed, too.

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

* openjpip: Initialize data before returning it

This fixes an error reported by Coverity:

CID 1190143 (#1 of 1): Uninitialized scalar variable (UNINIT)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-22 08:16:13 +02:00
Stefan Weil 39f9934a70 Fix potential out-of-bounds read (coverity) (#844)
* query_parser: Fix potential out-of-bounds read (coverity)

CID 1190207 (#1 of 1): Out-of-bounds read (OVERRUN)

Variable i must be checked before testing query_param.box_type.

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

* jpip_parser: Fix potential out-of-bounds read (coverity)

CID 1190206 (#1 of 1): Out-of-bounds read (OVERRUN)

Variable i must be checked before testing query_param.box_type.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-21 14:11:35 +02:00
Antonin Descampe 04a00aab65 Merge pull request #834 from trylab/issue833
Fix issue 833.
2016-09-20 19:04:49 +02:00
Antonin Descampe b7d73d7b25 Disable automatic compilation of t1_generate_luts
Fix #831
2016-09-20 18:51:35 +02:00
Antonin Descampe 25966346f7 Fix warnings from recent overflow checks
see #832
2016-09-16 17:48:20 +02:00
mayeut 43557dcd3b Add overflow checks for opj_aligned_malloc
See
https://pdfium.googlesource.com/pdfium/+/b20ab6c7acb3be1393461eb650ca8fa
4660c937e/third_party/libopenjpeg20/0020-opj_aligned_malloc.patch
2016-09-13 21:05:30 +02:00
Matthieu Darbois ee458b5fd0 Fix coverity 113065 (CWE-484) (#824) 2016-09-13 11:00:08 +02:00
Matthieu Darbois bf845a3892 Cast to size_t before multiplication
Need to cast to size_t before multiplication otherwise overflow check is useless.
2016-09-13 11:00:08 +02:00
Matthieu Darbois b75acb3bb9 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-13 11:00:08 +02:00
Matthieu Darbois 53b4bf29ca fix incrementing of "l_tcp->m_nb_mcc_records" in opj_j2k_read_mcc (#820) 2016-09-13 11:00:08 +02:00
trylab 5196bda0b9 Fix an integer overflow issue (#809)
Prevent an integer overflow issue in function opj_pi_create_decode of
pi.c.
2016-09-13 11:00:08 +02:00
Matthieu Darbois 3547402709 Add overflow check in opj_tcd_init_tile (#819) 2016-09-13 11:00:08 +02:00
Matthieu Darbois d60b7aa130 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-13 11:00:08 +02:00
Matthieu Darbois 98a97cef6b Add overflow check in opj_j2k_update_image_data (#817) 2016-09-13 11:00:08 +02:00
Matthieu Darbois c8fbf0f516 Change 'restrict' define to 'OPJ_RESTRICT' (#816)
Visual Studio 2015 does not pass regression tests with `__restrict` so kept disabled for MSVC.
Need to check proper usage of OPJ_RESTRICT (if correct then there’s
probably a bug  in vc14)

Closes #661
2016-09-13 11:00:07 +02:00
Stefan Weil eebd59a6d6 jpwl: Remove non-portable data type u_int16_t (fix issue #796) (#797)
The type casts which used this data type can be removed by changing
the signature of function swap16. As this function is called with
unsigned variables, this change is reasonable.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-13 11:00:07 +02:00
Stefan Weil ae2095ef14 Fix dependency for pkg-config (issue #594) (#795)
openjpeg provides libopenjp2.pc, so the require statements must refer to
libopenjp2 instead of openjp2.
Fixes #594

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-09-13 11:00:07 +02:00
maddin200 cb72c08472 Update tcd.c (#790)
cppcheck unitialized variable
2016-06-21 22:13:57 +02:00
Stefan Weil 4d2b6a671a Update implementation of opj_calloc (#705) 2016-05-10 22:08:49 +02:00
Stefan Weil aae066debc Add missing source for the JPIP library and executables (issue #658) (#659)
They all need opj_malloc and other functions from opc_malloc.c.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-05-10 22:02:49 +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
Julien Malik 17a0a8a195 Use lowercase for cmake commands consistenly
Inspired from https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/Maintenance/HowToCreateTheCMakeCaseConversion.txt
This needs vim 7.3 and fails with vim 7.4

This also fixes a number of :
- missing empty line at end of files
- useless space at end of lines
2016-05-02 16:05:41 +02:00
Julien Malik e1e018a8dc Fix UBSan gcc warning for first arg to memset non null 2016-05-02 12:13:24 +02:00
Antonin Descampe 72deb588cb Merge pull request #706 from mayeut/issue135
Fix issue 135
The fix is legal regarding the standard but I did not manage to find out if it covers a bug in opj_t2_read_packet_data or if the file is corrupted
2016-04-30 13:51:01 +02:00
mayeut cd77b6003b Fix some coverity warnings 2016-04-30 12:15:22 +02:00
mayeut f40a2ff2ad Fix bad call to fclose with NULL pointer 2016-04-30 01:50:33 +02:00
Matthieu Darbois be42e72d22 Fix warnings (#763) 2016-04-30 01:12:16 +02:00
Matthieu Darbois 15f081c896 Fix Out-Of-Bounds Read in sycc42x_to_rgb function (#745)
42x Images with an odd x0/y0 lead to subsampled component starting at the
2nd column/line.
That is offset = comp->dx * comp->x0 - image->x0 = 1

Fix #726
2016-04-30 00:33:27 +02:00
Matthieu Darbois ad593c9e06 Fix heap-buffer-overflow in color_esycc_to_rgb (#748)
When all components do not have the same dx/dy, components buffer are
read beyond their end.
Do not convert in this case.

Update uclouvain/openjpeg#725
2016-04-29 23:51:14 +02:00
julienmalik 319fc971fe cppcheck fix for openjp2 (#740) 2016-04-29 23:49:17 +02:00
Matthieu Darbois e166e4a209 Check SSIZ is valid in opj_j2k_read_siz (#762) 2016-04-28 19:20:14 +02:00
Matthieu Darbois 29313eb5f1 Fix unsigned int overflow reported by UBSan (#761)
* 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-04-28 13:16:43 +02:00
julienmalik e982d03966 Fix implicit float-to-bool conversions (#752) 2016-04-28 11:52:45 +02:00
Matthieu Darbois 66fd497765 Fix unsigned int overflow reported by UBSan (#759) 2016-04-28 00:18:37 +02:00
mayeut 20789fed4e Fix issue 135
dwt_interleave_h.gsr105.jp2 now has the same output as kakadu
issue399 is corrupted. Only the corrupted part changes.

Update known failures for x86 MD5

NR-DEC-kodak_2layers_lrcp.j2c-31-decode-md5
NR-DEC-kodak_2layers_lrcp.j2c-32-decode-md5
NR-DEC-issue135.j2k-68-decode-md5
2016-04-27 23:15:47 +02:00
Matthieu Darbois e6881e7527 Fix negative shift left reported by UBSan (#758)
Follow-up of #757

This shall have no performance impact on 2’s complement machine where
the compiler replaces the multiplication by power of two (constant) by
a left shift.
Verified at least on MacOS Xcode 7.3, same assembly generated after fix.
2016-04-27 21:56:09 +02:00
Stefan Weil 2296dc9e68 Remove whitespace and CR at line endings (#678)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-04-26 22:12:11 +02:00
Matthieu Darbois 6f2ac3ee36 Fix negative shift left reported by UBSan (#757)
This shall have no performance impact on 2’s complement machine where
the compiler replaces the multiplication by power of two (constant) by
a left shift.
Verified at least on MacOS Xcode 7.3, same assembly generated after fix.
2016-04-26 22:06:06 +02:00
Matthieu Darbois c559c62853 Do not define __attribute__ in opj_includes.h (#751)
Fix #727
2016-04-23 14:17:31 +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
Antonin Descampe e1a93d9e59 Merge pull request #708 from GrokImageCompression/issue_695
issue #695 MQ Encode: ensure that bp pointer never points to uninitialized memory
2016-04-18 10:51:51 +02:00
Antonin Descampe a1c0ee9a86 Merge pull request #734 from senbox-org/opj_dump_dead_code
Remove dead code in opj_dump
2016-04-12 10:48:02 +02:00
Julien Malik e7797b97a1 Fix uninitialized variable reported by cppcheck
Also reorder initialization to follow declaration order
2016-04-09 19:02:05 +02:00
Julien Malik 5e5f6999a8 Remove dead code in opj_dump 2016-04-09 18:34:11 +02:00