Commit Graph

82 Commits

Author SHA1 Message Date
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 f0629cb1c4
Fix various compiler warnings 2021-06-07 13:28:26 +02:00
Even Rouault 1c54024165
opj_decompress: add sanity checks to avoid segfault in case of decoding error
Prevent crashes like:
opj_decompress -i 0722_5-1_2019.jp2 -o out.ppm -r 4 -t 0

where 0722_5-1_2019.jp2 is
https://drive.google.com/file/d/1ZxOUZg2-FKjYwa257VFLMpTXRWxEoP0a/view?usp=sharing
2020-04-01 21:11:36 +02:00
Hugo Lefeuvre cab352e249 jp2: convert: fix null pointer dereference
Tile components in a JP2 image might have null data pointer by defining a
zero component size (for example using large horizontal or vertical
sampling periods). This null data pointer leads to null image component
data pointer, causing crash when dereferenced without != null check in
imagetopnm.

Add != null check.

This commit addresses #1152 (CVE-2018-18088).
2018-11-07 18:53:18 +01:00
szukw000 98363e244e Changes in pnmtoimage if image data are missing 2018-08-31 16:24:41 +02:00
Stefan Weil 4841292b5d Fix resource leak (CID 179466)
Coverity report:

CID 179466 (#1 of 1): Resource leak (RESOURCE_LEAK)
93. leaked_storage: Variable name going out of scope leaks the storage it points to.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2017-12-15 16:49:33 +01:00
Even Rouault 5146abc02e imagetopgx(): improve performance in 8 bit case (relates to broken.jpc test case) 2017-08-24 14:09:31 +02:00
Even Rouault 3eed024eb4 pgxtoimage(): avoid excessive memory allocation attempt (#999) 2017-08-19 15:45:54 +02:00
Even Rouault e528531922 pgxtoimage(): fix write stack buffer overflow (#997) 2017-08-18 13:39:20 +02:00
Even Rouault 17ea17f487 Fix -Wconversion warning 2017-08-17 19:05:29 +02:00
Even Rouault da046b73a8 convert.c: fix recently introduced -Wsign-conversion warnings 2017-08-17 17:02:40 +02:00
Even Rouault 2cd30c2b06 tgatoimage(): avoid excessive memory allocation attempt, and fixes unaligned load (#995) 2017-08-17 11:47:40 +02:00
Even Rouault ab4de904e7 imagetotga(): fix read heap buffer overflow if numcomps < 3 (#987) 2017-08-16 13:11:36 +02:00
szukw000 00f45684a8 Catch images broken by AFL 2017-07-31 13:58:08 +02:00
Even Rouault c22cbd8bdf Avoid heap buffer overflow in function pnmtoimage of convert.c, and unsigned integer overflow in opj_image_create() (CVE-2016-9118, #861) 2017-07-30 18:43:25 +02:00
Even Rouault 784d4d47e9 Fix breakage of 2fa0fc61f2 (#970) 2017-07-29 17:51:10 +02:00
Even Rouault 2fa0fc61f2 imagetopnm(): make sure the alpha component has same dimension as other components to avoid read heap buffer overflow (#970) 2017-07-29 17:28:55 +02:00
Even Rouault 563bd8499e Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +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
mayeut f40a2ff2ad Fix bad call to fclose with NULL pointer 2016-04-30 01:50:33 +02:00
julienmalik 319fc971fe cppcheck fix for openjp2 (#740) 2016-04-29 23:49:17 +02:00
mayeut ce26e523dd Fix compiler warnings 2015-11-01 16:56:50 +01:00
Stefan Weil 7dfcbf9d7b convert: Fix compiler warnings
Fix this and other similar compiler warnings:

src/bin/jp2/convert.c: In function ‘tga_readheader’:
src/bin/jp2/convert.c:595:5: warning:
 dereferencing type-punned pointer will break strict-aliasing rules
 [-Wstrict-aliasing]
     cmap_len = get_ushort(*(unsigned short*)(&tga[5]));

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-01 16:54:38 +01:00
Stefan Weil 4ac509182a convert: Remove unneeded type casts
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-11-01 16:53:55 +01:00
Stefan Weil ad7eb5630e Fix format strings and unneeded assignment
The static code analyzer cppcheck warns about unsigned integers
which use "%d" in the format string.

It also warns about an unneeded assignment.

Fix both issues.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-10-18 19:52:57 +02:00
mayeut cf352af089 Fix up-scaling bit depth
Fixes #609
2015-09-29 09:28:34 +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 f9df8ba19a Fix some resource leaks 2015-09-24 23:32:03 +02:00
mayeut f82d7f3a63 Use buffer on stack to read TGA header
Fixes a potential leak
Fixes #601
2015-09-23 21:17:06 +02:00
ak-dxdy acbb297a0a Small correction + attempt to understand git-openjpeg workflow 2015-07-31 00:51:31 +02:00
mayeut f3dad25c77 Update convert for PNG output
Update uclouvain/openjpeg#264
2015-07-26 18:28:03 +02:00
mayeut c423cc84e7 Remove some warnings when building
Update #442
2015-07-26 02:41:39 +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 ac9fb5a302 Update tiftoimage to support more input TIF formats
Update uclouvain/openjpeg#322
Update uclouvain/openjpeg#264
2015-07-14 23:51:02 +02:00
mayeut dc43ebf96c Add option to force component splitting in imagetopnm
Update uclouvain/openjpeg#289
2015-07-11 11:35:21 +02:00
Antonin Descampe eadfad7a50 commented out printf line 2015-07-03 17:36:39 +02:00
Antonin Descampe 14361eee24 commented out a printf line 2015-07-03 16:35:16 +02:00
Matthieu Darbois 33f52fb611 [trunk] removed warning from convert.c
Update  issue 442
2014-12-23 16:03:45 +00:00
Matthieu Darbois 81abe5b3bb [trunk] fixed imagetoraw unsigned 16bits conversion (fixes issue 460) 2014-12-23 15:06:23 +00:00
Matthieu Darbois 6922124c4c [trunk] fixed colorspace mapping for raw grayscale images (fixes issue 456) 2014-12-22 18:39:14 +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 f1bae45c76 [trunk] fixed BMP reading for 8bpp when width & 3 == 1
Update  issue 203
2014-12-20 18:45:53 +00:00
Matthieu Darbois c0710f557c [trunk] Fixed invalid check in in tiff reading method (fixes issue 449) 2014-12-11 20:21:26 +00:00
Matthieu Darbois 63f877769c [trunk] removed some warnings when building src/bin/jp2/convert.c
Update  issue 442
2014-11-25 20:06:12 +00:00
Matthieu Darbois 13bcb63b73 [trunk] fixed pnmtoimage for odd pgm files (fixes issue 294) 2014-11-22 14:09:16 +00:00
Matthieu Darbois 3bc360fc9d [trunk] added option to force output bit depth in opj_decompress (fixes issue 283) 2014-11-19 20:05:39 +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 50a205d20f [trunk] improve memory management (fixes issue 359) 2014-09-16 15:48:04 +00:00
Antonin Descampe 7d21871ed8 [trunk] fixes issue #357. MCT is automatically disabled when
subsamppling is detected.
2014-07-03 09:15:13 +00:00
Antonin Descampe 7199d9b5d3 [trunk] refactoring of rsiz, profiles, and extensions management 2014-04-17 09:31:37 +00:00