Fix invalid conversion from RGB8 to CMYK32 due to overflow by mloskot · Pull Request #470 · boostorg/gil
mloskot
changed the title
Fix overflow in RGB to CMYK32 conversion
Fix invalid conversion from RGB8 to CMYK32 due to overflow
Correct calculation to correctly map CMYK 0 to minimum and 1 to maximum of input and output channel types. If float-point division is necessary, use double instead of float which may be too narrow for large operands. cmyk32_pixel_t is based on uint32_t which multiplication by its maximum may yield result too large to fit 32-bit float. For example, (uint32_t(c) - uint32_t(k)) * float(s) for c = 4294967295, k = 0, s = 1.0 results in 4294967300 value which does not fit uint32_t. Fixes boostorg#406
mloskot
marked this pull request as ready for review
mloskot
deleted the
ml/fix-rgb-to-cmyk32-fp-overflow
branch
mloskot added a commit that referenced this pull request
Jul 11, 2020* develop: Collect release notes for Boost 1.74 Fix missing header in numeric/kernel.hpp to make it self-contained (#502) Use perfect forwading from apply_operation to visit (#491) Fix typos and replace mpl with mp11 in tutorial (#494) Implemented mechanism to reverse kernel_2d (#489) added missing const& in extend_boundary parameters (#490) Add initializing image constructor (#486) Fix interleaved_view factory using point<std::ptrdiff_t> for dimension (#487) RELEASES.md: Remove beta tag [ci skip] Replace Boost.Variant with Boost.Variant2 (#474) Fix error plane_view_t is not a class or namespace name (#481) Fix image constructor from other image (#477) Fix overflow in RGB to CMYK32 conversion (#470)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters