Even Rouault
3fbe713690
opj_tcd_get_decoded_tile_size(): fix potential UINT32 overflow ( #854 , CVE-2016-5152)
...
Fix derived from https://pdfium.googlesource.com/pdfium.git/+/d8cc503575463ff3d81b22dad292665f2c88911e/third_party/libopenjpeg20/0018-tcd_get_decoded_tile_size.patch
2017-07-29 18:38:16 +02:00
Even Rouault
361c4506fd
opj_tcd_dc_level_shift_decode(): avoid int overflow. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2516 . Credit to OSS Fuzz
2017-07-28 22:06:26 +02:00
Even Rouault
820fcfe8bb
opj_j2k_update_image_data / opj_tcd_update_tile_data: fix unaligned load/store ( #895 )
...
When components don't have the same width, unaligned load/store are possible.
Fixes openjeg-crashes-2017-07-27/id:000000,sig:11,src:001342,op:flip4,pos:162.jp2 of #895
2017-07-27 19:35:35 +02:00
Even Rouault
94c4b7300c
T1 decoder: check code stream errors when predictable termination is enabled and emit a warning when errors are found
2017-07-26 21:43:32 +02:00
Even Rouault
9cbc9903c3
Merge branch 't1_flag_optimizations'
2017-06-13 12:09:52 +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
532243f1fd
MQC/RAW decoder: use an artificial 0xFF 0xFF terminating marker.
...
This saves comparing the current pointer with the end of buffer pointer.
This results at least in tiny speed improvement for raw decoding, and
smaller code size for MQC as well.
This kills the remains of the raw.h/.c files that were only used for
decoding. Encoding using the mqc structure already.
2017-06-02 18:24:07 +02:00
Even Rouault
563bd8499e
Reformat whole codebase with astyle.options ( #128 )
2017-05-09 20:46:20 +02:00
Even Rouault
a43f1bea62
Remove warnings related to empty tag-trees.
...
Decoding some valid .jp2 files like Sentinel2 datasets leads to warnings like:
No incltree created.
tgt_create tree->numnodes == 0, no tree created.
No imsbtree created.
tgt_create tree->numnodes == 0, no tree created.
Besides that, the image is correctly decoded. So there is no reason to emit
those warnings.
2017-02-13 12:36:45 +01: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
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
ea320dab8b
Add overflow check in opj_tcd_init_tile ( #819 )
2016-09-06 07:54:29 +02:00
Even Rouault
57b216bb58
Use thread pool for DWT decoding
2016-05-25 21:02:07 +02:00
Even Rouault
5fbb8b2645
Use thread-pool for T1 decoding
2016-05-25 21:02:07 +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
mayeut
8f9cc62b3f
Fix division by zero
...
Fix uclouvain/openjpeg#733
2016-05-08 18:40:12 +02:00
mayeut
cd77b6003b
Fix some coverity warnings
2016-04-30 12:15:22 +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
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
mayeut
8034ffde8b
Fix inconsistent behavior of malloc(0)
...
Update #635
Update #625
2015-10-17 02:55:09 +02:00
mayeut
83249c318f
Fixed crash on encoding
...
Update #624
Update #625
2015-10-17 01:30:23 +02:00
Mathieu Malaterre
d753441028
implement a portable aligned realloc
2015-10-10 17:51:29 +02:00
mayeut
de0a9ed103
Revert "Make sure to allocate on 16bits alignement. Fix issue #624 "
...
This reverts commit 553714a87a
.
2015-10-09 21:13:06 +02:00
Mathieu Malaterre
553714a87a
Make sure to allocate on 16bits alignement. Fix issue #624
2015-10-09 15:37:09 +02:00
Matthieu Darbois
bac2c9e0a3
Change test in opj_tcd_makelayer
...
Remove float equality test. Such a test has no meaning.
2015-09-11 14:17:30 +02:00
Matthieu Darbois
ee0f313848
Update check in opj_tcd_makelayer to be robust to different float precisions
2015-09-10 15:46:51 +02:00
Matthieu Darbois
ccdce606f1
Fix threshold calculation
...
It doesn't change the outcome of the test suite, that's weird...
2015-09-10 15:10:14 +02:00
mayeut
5f02757eef
Correct lossless issue on linux x86
...
Update uclouvain/openjpeg#571
2015-09-10 00:39:23 +02:00
mayeut
38770403d4
Fix some calculations in opj_tcd_init_tile
...
Fixes #486
Fixes #394
Update #480
Update #388
2015-08-23 11:38:04 +02: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
c423cc84e7
Remove some warnings when building
...
Update #442
2015-07-26 02:41:39 +02:00
mayeut
9ac3a1572e
Prevent overflow when coding 16 bits images
...
Update uclouvain/openjpeg#539
2015-07-22 00:10:32 +02:00
mayeut
ae4799ad07
Add some missing static
...
Still needs to check j2k.c & jp2.c
Update uclouvain/openjpeg#243
2015-07-18 02:39:32 +02:00
Antonin Descampe
2d24b6000d
[trunk] added overflow checks (fixes issue 431)
...
Thanks mdarbois
2015-02-02 16:11:31 +00:00
Antonin Descampe
5d00b719f4
[trunk] fixed a buffer overflow in opj_tcd_init_decode_tile
...
Update issue 431
2015-01-15 18:16:29 +00:00
Matthieu Darbois
9a21e1eef0
[trunk] removed warnings when building tcd.c (Update issue 442)
2014-12-15 18:48:50 +00:00
Matthieu Darbois
e05d2901ec
[trunk] Reduce encoder code block memory usage for non 64x64 code block sizes (fixes issue 444)
2014-12-12 21:54:22 +00:00
Antonin Descampe
8d320bbdf8
[trunk] check number of components when getting mct norm (fixes issue 436)
2014-12-09 12:09:08 +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
Matthieu Darbois
ae1da37558
[trunk] replace OPJ_MACRO_TCD_ALLOCATE macro by inlined function (fixes issue 433)
2014-11-19 19:08:09 +00:00
Antonin Descampe
c3629e37a2
[trunk] significantly reduces memory for single tile RGB encoding (fixes
...
issue 375)
2014-11-03 14:51:41 +00:00
Antonin Descampe
3e1fad2da4
[trunk] resets resno_decoded for each tile (fixes issue 399)
2014-10-22 13:16:35 +00:00
Antonin Descampe
d72940c56b
[trunk] resets code-blocks reused for other tiles than the first one (fixes issue 418)
2014-10-22 13:16:12 +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
7199d9b5d3
[trunk] refactoring of rsiz, profiles, and extensions management
2014-04-17 09:31:37 +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
3a80b72ac8
[trunk] Add a temporary work around for issue 293
...
As described in the bug report the default allocation mecanism for codeblock data is too small for those dataset (16bits). We would need a finer (more granular) mecanism to reallocated only on demand. For now this help the two failing tests to pass.
Fixes issue 293
2014-03-14 10:54:08 +00:00
Mathieu Malaterre
2e7b8fb9a1
[trunk] Another final round of fixes for sign conversion warnings.
...
Fixes issue 256
2014-03-10 16:43:04 +00:00
Mathieu Malaterre
cc1354ebfa
[trunk] Another round of fixes for sign conversion warnings.
...
Update issue 256
2014-03-07 14:00:47 +00:00
Mathieu Malaterre
1ef677f264
[trunk] Make sure to reject images such as 1336.pdf.asan.47.376.jp2
...
Fixes issue 267
2014-03-04 10:32:26 +00:00
Mathieu Malaterre
07193e2a34
[trunk] remove more conversion warning in multi-lines macro.
...
C allow simple tricks such as to find those:
gcc -E tcd.c | sed '/^\#/d' | indent -st -i2 > clean.c
Update issue 256
2014-03-04 09:58:07 +00:00
Mathieu Malaterre
7185faa857
[trunk] Remove warning about conversion.
...
Update issue 256
2014-03-04 09:19:49 +00:00
Mathieu Malaterre
2c876b6765
[trunk] Remove simple warnings about comments, missing case in switch statement
2014-03-02 10:16:54 +00:00
Mathieu Malaterre
23ea270881
[trunk] Import patch from sumatrapdf team. This handle testcase 1336.pdf.asan.47.376
...
Update issue 225
2014-02-26 11:27:01 +00:00
Mathieu Malaterre
7247543da3
[trunk] Import patch from sumatrapdf team. This handle testcase 1888.pdf.asan.35.988
...
Update issue 225
2014-02-26 11:26:09 +00:00
Mickael Savinaud
8b36a11f2b
[trunk] backout one part of the rev 2266
2013-02-03 09:07:23 +00:00
Mickael Savinaud
b65bf48369
[trunk] merge from branch 1.5 a correction about large code-block data (decoding part) and add tests about issue 5 and issue 62
2012-12-18 17:46:33 +00:00
Mickael Savinaud
fcf9fa3651
[trunk] add opj_ prefix to some internal define and use the new opj type instead of int and float in some files
2012-11-16 08:29:43 +00:00
Mickael Savinaud
d5efeb7df5
[trunk]update the copyright, the authors and thanks to respect the license
2012-11-15 15:22:29 +00:00
Mickael Savinaud
ec0fe09138
[trunk] move opj_bool to OPJ_BOOL to follow the other type
2012-11-15 13:13:36 +00:00
Mickael Savinaud
84c93c2fea
[trunk] rename public symbols with OPJ_ prefix
2012-11-15 12:25:11 +00:00
Mickael Savinaud
bcc386e3bb
[trunk]remove some warnings raised by Wall
2012-10-26 09:39:52 +00:00
Mickael Savinaud
9b6900b058
[trunk] [trunk] remove old opj_tcp and rename opj_tcp_v2 to opj_tcp
2012-10-25 15:15:02 +00:00
Mickael Savinaud
7f7ef068fc
[trunk] [trunk] remove old opj_cp and rename opj_cp_v2 to opj_cp
2012-10-25 15:09:31 +00:00
Mickael Savinaud
a41790ce8a
[trunk] [trunk] remove old opj_t2 and rename opj_t2_v2 to opj_t2
2012-10-25 14:54:19 +00:00
Mickael Savinaud
06615a556d
[trunk] rename opj_tcd_truct_v2 to opj_tcd_struct
2012-10-25 14:49:10 +00:00
Mickael Savinaud
f824078c14
[trunk] rename opj_event_msg_v2 to opj_event_msg
2012-10-25 13:49:20 +00:00
Mickael Savinaud
f649754018
[trunk] correct a small warning raised by continous
2012-10-24 14:52:15 +00:00
Mickael Savinaud
b1c5ce2517
[trunk] remove old structures from tcd.h
2012-10-24 14:38:07 +00:00
Mickael Savinaud
f2db5ec4fb
[trunk] use the right v2 structure
2012-10-24 14:10:03 +00:00
Mickael Savinaud
216791c3fb
[trunk] Finalize dwt.v/.h with the v2 style : remove last functions already optimized, add opj_ prefix, use new name of the functions
2012-10-24 09:29:34 +00:00
Mickael Savinaud
4b140e060b
[trunk] rename int.h to opj_intmath.h and rename all its functions with opj_ prefix
2012-10-05 09:10:15 +00:00
Mickael Savinaud
f4a8f7165c
[trunk] update global functions of tgt with opj_ prefix
2012-10-03 15:06:58 +00:00
Mickael Savinaud
6a84a1788b
{trunk]update mct functions with opj_ prefix and new opj type
...
add some comments
2012-10-03 09:47:50 +00:00
Mathieu Malaterre
394db7b738
[trunk] Remove old function tgt_create
...
Fix some warnings about size_t
2012-10-01 15:29:36 +00:00
Mathieu Malaterre
d518970039
[trunk] Start FolderReorgProposal task
...
Update issue 177
2012-09-28 08:11:41 +00:00