openjpeg/src/bin/jp2
Hugo Lefeuvre ca16fe5501 convertbmp: fix issues with zero bitmasks
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)
2018-09-22 14:51:50 -04:00
..
CMakeLists.txt Changed cmake version test to allow for cmake 2.8.11.x 2017-11-14 21:45:09 +11:00
convert.c Fix resource leak (CID 179466) 2017-12-15 16:49:33 +01:00
convert.h Reformat: apply reformattin on .h files (#128) 2017-05-15 12:21:30 +02:00
convertbmp.c convertbmp: fix issues with zero bitmasks 2018-09-22 14:51:50 -04:00
convertpng.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
converttif.c tiftoimage(): fix read heap buffer overflow (#988) 2017-08-16 13:36:52 +02:00
index.c Reformat whole codebase with astyle.options (#128) 2017-05-09 20:46:20 +02:00
index.h Reformat: apply reformattin on .h files (#128) 2017-05-15 12:21:30 +02:00
opj_compress.c opj_compress: try to make help message of -c switch clearer (fixes #1117) 2018-06-16 16:17:58 +02:00
opj_decompress.c opj_decompress -h: document -threads ALL_CPUS 2017-10-06 19:25:07 +02:00
opj_dump.c First change on changes-for-afl-tests 2017-08-02 17:27:08 +02:00
windirent.h Fix mingw related warnings 2017-06-21 12:54:40 +02:00