summaryrefslogtreecommitdiff
path: root/src/bin/jp2/convertbmp.c
AgeCommit message (Collapse)Author
2024-02-28Fix some typos (found by `codespell` and `typos`)Stefan Weil
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2021-10-21API: deprecate 'bpp' member in favor of 'prec'Even Rouault
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
2019-04-15bmp_read_rle4_data(): avoid potential infinite loopYoung Xiao
2019-04-15convertbmp: detect invalid file dimensions earlyYoung Xiao
width/length dimensions read from bmp headers are not necessarily valid. For instance they may have been maliciously set to very large values with the intention to cause DoS (large memory allocation, stack overflow). In these cases we want to detect the invalid size as early as possible. This commit introduces a counter which verifies that the number of written bytes corresponds to the advertized width/length. See commit 8ee335227bbc for details. Signed-off-by: Young Xiao <YangX92@hotmail.com>
2018-12-14convertbmp: detect invalid file dimensions earlyHugo Lefeuvre
width/length dimensions read from bmp headers are not necessarily valid. For instance they may have been maliciously set to very large values with the intention to cause DoS (large memory allocation, stack overflow). In these cases we want to detect the invalid size as early as possible. This commit introduces a counter which verifies that the number of written bytes corresponds to the advertized width/length. Fixes #1059 (CVE-2018-6616).
2018-10-31Fix some potential overflow issues (#1161)Stefan Weil
* Fix some potential overflow issues Put sizeof to the beginning of the multiplication to enforce that size_t instead of smaller integer types is used for the calculation. This fixes warnings from LGTM: Multiplication result may overflow 'unsigned int' before it is converted to 'unsigned long'. It also allows removing some type casts. Signed-off-by: Stefan Weil <sw@weilnetz.de> * Fix code indentation Signed-off-by: Stefan Weil <sw@weilnetz.de>
2018-09-22convertbmp: fix issues with zero bitmasksHugo Lefeuvre
In the case where a BMP file declares compression 3 (BI_BITFIELDS) with header size <= 56, all bitmask values keep their initialization value 0. This may lead to various undefined behavior later e.g. when doing 1 << (l_comp->prec - 1). This issue does not affect files with bit count 16 because of a check added in 16240e2 which sets default values to the color masks if they are all 0. This commit adds similar checks for the 32 bit case. Also, if a BMP file declares compression 3 with header size >= 56 and intentional 0 bitmasks, the same issue will be triggered in both the 16 and 32 bit count case. This commit adds checks to bmp_read_info_header() rejecting BMP files with "intentional" 0 bitmasks. These checks might be removed in the future when proper handling of zero bitmasks will be available in openjpeg2. fixes #1057 (CVE-2018-5785)
2017-08-18bmp_read_rle8_data(): avoid potential infinite loop (#996)Even Rouault
2017-08-14bmp_read_info_header(): reject bmp files with biBitCount == 0 (#983)Even Rouault
2017-08-09imagetobmp: avoid shift by -1 (relates to #811)Even Rouault
2017-07-31Catch images broken by AFLszukw000
2017-07-26Spelling fixes (patch by ka7, #890, rebased on top of master)Even Rouault
2017-05-09Reformat whole codebase with astyle.options (#128)Even Rouault
2016-09-13Fix issue 833.trylab
Add some overflow check operations.
2016-04-30Fix Out-Of-Bounds Read in sycc42x_to_rgb function (#745)Matthieu Darbois
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-29cppcheck fix for openjp2 (#740)julienmalik
2015-09-25Fix resource leaks & unchecked resource allocationsmayeut
2015-09-24Fix some resource leaksmayeut
2015-09-23Fix warning in rle4 decodingmayeut
2015-08-23Fix some UBSan warningsmayeut
2015-07-26Remove some warnings when buildingmayeut
Update #442
2014-12-27[trunk] removed warning from convertbmp.cMatthieu Darbois
Update issue 442
2014-12-23[trunk] removed warning from convertbmp.cMatthieu Darbois
Update issue 442
2014-12-22[trunk] updated BMP format input supportMatthieu Darbois
Update issue 203
2014-12-22[trunk] updated BMP format input supportMatthieu Darbois
Update issue 203
2014-12-20[trunk] fixed BMP reading for 8bpp when width & 3 == 1Matthieu Darbois
Update issue 203