Skip to content

Fix: CIccCombinedConnectionConditions::CIccCombinedConnectionConditions()#691

Merged
xsscx merged 1 commit intomasterfrom
issue-676
Mar 15, 2026
Merged

Fix: CIccCombinedConnectionConditions::CIccCombinedConnectionConditions()#691
xsscx merged 1 commit intomasterfrom
issue-676

Conversation

@ChrisCoxArt
Copy link
Contributor

FIxes #676

Pull Request Checklist

  • Have you followed the guidelines in Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you built your Pull Request locally with the Build Instructions?
  • Have you added or updated relevant tests?
  • Have you added or updated relevant docs?

@ChrisCoxArt ChrisCoxArt requested a review from xsscx as a code owner March 15, 2026 01:49
@xsscx xsscx self-assigned this Mar 15, 2026
@xsscx xsscx added PR Pull Request Review in Process Issue is being Reviewed by Maintainers Pending Merge Maintainer indicates Merge Pending and requests no further changes and removed pending Review in Process Issue is being Reviewed by Maintainers labels Mar 15, 2026
Copy link
Member

@xsscx xsscx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer Review

2026-03-15 01:58:45 UTC

Repro

mkdir pr-691
cd pr-691
git clone https://github.com/InternationalColorConsortium/iccDEV.git
cd iccDEV/Build
git fetch origin pull/691/head:pr-691
git checkout pr-691
export CXX=clang++ && export CXXFLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g -O1 -fprofile-arcs -ftest-coverage" && export LDFLAGS="-fsanitize=address,undefined -fprofile-arcs" && cmake Cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_ASAN=ON -DENABLE_UBSAN=ON -DENABLE_COVERAGE=ON
make -j$(nproc)
        cd ../Testing/
        echo "=== Updating PATH ==="
         for d in ../Build/Tools/*; do
          [ -d "$d" ] && export PATH="$(realpath "$d"):$PATH"
         done
cd ..
wget https://github.com/xsscx/fuzz/raw/refs/heads/master/graphics/icc/npd-CIccCombinedConnectionConditions-IccPcc_cpp-Line337.icc
printf "'RGB '\t; Data Format\nicEncodeFloat\t; Encoding\n\n0.5 0.5 0.5\n" > pcc-test-data.txt
iccApplyNamedCmm pcc-test-data.txt 0 0 Testing/Display/Rec2020rgbSpectral.icc 0 -PCC npd-CIccCombinedConnectionConditions-IccPcc_cpp-Line337.icc

PR Application Output

[2026-03-15 01:58:04 UTC] ~/pr-691/iccDEV (pr-691)$ git log --oneline --graph -1
* f9a3449 (HEAD -> pr-691, origin/issue-676) check that the PCC has required data before dereferencing it
[2026-03-15 01:58:20 UTC] ~/pr-691/iccDEV (pr-691)$ file Testing/Display/Rec2020rgbSpectral.icc
Testing/Display/Rec2020rgbSpectral.icc: color profile 5.0, RGB/XYZ-mntr device, 24620 bytes, 11-3-2026 10:52:32, embedded, relative colorimetric, PCS X=0xf34f Z=0x116a5, 0x304896b5c015520 MD5 'Rec. 2020 RGB Spectral'
[2026-03-15 01:58:23 UTC] ~/pr-691/iccDEV (pr-691)$ file npd-CIccCombinedConnectionConditions-IccPcc_cpp-Line337.icc
npd-CIccCombinedConnectionConditions-IccPcc_cpp-Line337.icc: color profile 5.0, RGB/XYZ-mntr device, 832 bytes, 13-3-2026 15:03:44, embedded, PCS X=0xf34d Z=0x116c2, 0xf0cb0b1fe858bb33 MD5 'CFL-019 PoC - No svcn'
[2026-03-15 01:58:26 UTC] ~/pr-691/iccDEV (pr-691)$ iccApplyNamedCmm pcc-test-data.txt 0 0 Testing/Display/Rec2020rgbSpectral.icc 0 -PCC npd-CIccCombinedConnectionConditions-IccPcc_cpp-Line337.icc
Error 3 - Unable to begin profile application - Possibly invalid or incompatible profiles

=================================================================
==26636==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 208 byte(s) in 1 object(s) allocated from:
    #0 0x629076db2e71 in operator new(unsigned long) (/home/h02332/pr-691/iccDEV/Build/Tools/IccApplyNamedCmm/iccApplyNamedCmm+0x15be71) (BuildId: f3d1ab79afbddeb2140f16551f3b28b62da5b468)
    #1 0x7bb28a8ef602 in OpenIccProfile(char const*, bool) /home/h02332/pr-691/iccDEV/IccProfLib/IccProfile.cpp:3559:23
    #2 0x629076db6e4b in main /home/h02332/pr-691/iccDEV/Tools/CmdLine/IccApplyNamedCmm/iccApplyNamedCmm.cpp:362:21
    #3 0x7bb289a2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #4 0x7bb289a2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #5 0x629076cd9a04 in _start (/home/h02332/pr-691/iccDEV/Build/Tools/IccApplyNamedCmm/iccApplyNamedCmm+0x82a04) (BuildId: f3d1ab79afbddeb2140f16551f3b28b62da5b468)

Indirect leak of 200 byte(s) in 5 object(s) allocated from:
    #0 0x629076db2e71 in operator new(unsigned long) (/home/h02332/pr-691/iccDEV/Build/Tools/IccApplyNamedCmm/iccApplyNamedCmm+0x15be71) (BuildId: f3d1ab79afbddeb2140f16551f3b28b62da5b468)
    #1 0x7bb28a8f5858 in std::__new_allocator<std::_List_node<IccTagEntry>>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/new_allocator.h:151:27
    #2 0x7bb28a8f5858 in std::allocator_traits<std::allocator<std::_List_node<IccTagEntry>>>::allocate(std::allocator<std::_List_node<IccTagEntry>>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:482:20
    #3 0x7bb28a8f5858 in std::__cxx11::_List_base<IccTagEntry, std::allocator<IccTagEntry>>::_M_get_node() /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_list.h:518:16
    #4 0x7bb28a8f5858 in std::_List_node<IccTagEntry>* std::__cxx11::list<IccTagEntry, std::allocator<IccTagEntry>>::_M_create_node<IccTagEntry const&>(IccTagEntry const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_list.h:710:21
    #5 0x7bb28a8f5782 in void std::__cxx11::list<IccTagEntry, std::allocator<IccTagEntry>>::_M_insert<IccTagEntry const&>(std::_List_iterator<IccTagEntry>, IccTagEntry const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_list.h:2005:18
    #6 0x7bb28a8c8494 in CIccProfile::ReadBasic(CIccIO*) /home/h02332/pr-691/iccDEV/IccProfLib/IccProfile.cpp:1270:12
    #7 0x7bb28a8c6016 in CIccProfile::Attach(CIccIO*, bool) /home/h02332/pr-691/iccDEV/IccProfLib/IccProfile.cpp:695:8
    #8 0x7bb28a8ef67d in OpenIccProfile(char const*, bool) /home/h02332/pr-691/iccDEV/IccProfLib/IccProfile.cpp:3561:14
    #9 0x629076db6e4b in main /home/h02332/pr-691/iccDEV/Tools/CmdLine/IccApplyNamedCmm/iccApplyNamedCmm.cpp:362:21
    #10 0x7bb289a2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #11 0x7bb289a2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #12 0x629076cd9a04 in _start (/home/h02332/pr-691/iccDEV/Build/Tools/IccApplyNamedCmm/iccApplyNamedCmm+0x82a04) (BuildId: f3d1ab79afbddeb2140f16551f3b28b62da5b468)

Indirect leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x629076db2e71 in operator new(unsigned long) (/home/h02332/pr-691/iccDEV/Build/Tools/IccApplyNamedCmm/iccApplyNamedCmm+0x15be71) (BuildId: f3d1ab79afbddeb2140f16551f3b28b62da5b468)
    #1 0x7bb28a8ef56c in OpenIccProfile(char const*, bool) /home/h02332/pr-691/iccDEV/IccProfLib/IccProfile.cpp:3552:25
    #2 0x629076db6e4b in main /home/h02332/pr-691/iccDEV/Tools/CmdLine/IccApplyNamedCmm/iccApplyNamedCmm.cpp:362:21
    #3 0x7bb289a2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #4 0x7bb289a2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #5 0x629076cd9a04 in _start (/home/h02332/pr-691/iccDEV/Build/Tools/IccApplyNamedCmm/iccApplyNamedCmm+0x82a04) (BuildId: f3d1ab79afbddeb2140f16551f3b28b62da5b468)

SUMMARY: AddressSanitizer: 424 byte(s) leaked in 7 allocation(s).

@xsscx xsscx changed the title check that the PCC has required data before dereferencing it Fix: CIccCombinedConnectionConditions::CIccCombinedConnectionConditions() Mar 15, 2026
@xsscx xsscx merged commit 3e96fce into master Mar 15, 2026
27 checks passed
@xsscx xsscx removed the Pending Merge Maintainer indicates Merge Pending and requests no further changes label Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR Pull Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UB null pointer at IccProfLib/IccPcc.cpp:337

2 participants