Conversation
And always calculate bytesPerSample And make the output buffer calc easier to debug Fixes #672
Member
Status2026-03-15 01:13:15 UTC @ChrisCoxArt Do you want me to roll this into a new issue after the Merge of do you want to fix it this PR? Your choice.. will Merge if you are busy and open a Issue. Thank You!! |
xsscx
approved these changes
Mar 15, 2026
Member
xsscx
left a comment
There was a problem hiding this comment.
Maintainer Review
2026-03-15 01:15:58 UTC
Repro
mkdir pr-686
cd pr-686
git clone https://github.com/InternationalColorConsortium/iccDEV.git
cd iccDEV/Build
git fetch origin pull/686/head:pr-686
git checkout pr-686
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
wget https://github.com/xsscx/fuzz/raw/refs/heads/master/graphics/tif/hbo-CTiffImg-WriteLine-TiffImg_cpp-Line411.tif
wget https://github.com/xsscx/fuzz/raw/refs/heads/master/graphics/icc/hbo-CTiffImg-WriteLine-TiffImg_cpp-Line411.icc
ASAN_OPTIONS=print_scariness=1 iccSpecSepToTiff hbo-CTiffImg-WriteLine-TiffImg_cpp-Line411.icc 0 0 hbo-CTiffImg-WriteLine-TiffImg_cpp-Line411.tif 0 0 1
PR Application Output
[2026-03-15 01:13:15 UTC] ~/pr-686/iccDEV/Testing (pr-686)$ ASAN_OPTIONS=print_scariness=1 iccSpecSepToTiff hbo-CTiffImg-WriteLine-TiffImg_cpp-Line411.icc 0 0 hbo-CTiffImg-WriteLine-TiffImg_cpp-Line411.tif 0 0 1
TIFFReadDirectory: Warning, Unknown field with tag 14645 (0x3935) encountered.
TIFFFetchNormalTag: Warning, Incorrect count for "PhotometricInterpretation"; tag ignored.
_TIFFVSetField: hbo-CTiffImg-WriteLine-TiffImg_cpp-Line411.tif: Bad value 69 for "ResolutionUnit" tag.
TIFFFetchNormalTag: Defined set_field_type of custom tag 14645 (Tag 14645) is TIFF_SETGET_UNDEFINED and thus tag is not read from file.
TIFFReadDirectory: Warning, Bogus "StripByteCounts" field, ignoring and calculating from imagelength.
Image successfully written!
=================================================================
==14727==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs operator delete) on 0x502000000130
SCARINESS: 10 (alloc-dealloc-mismatch)
#0 0x5a534eb1f2a1 in operator delete(void*) (/home/h02332/pr-686/iccDEV/Build/Tools/IccSpecSepToTiff/iccSpecSepToTiff+0x10e2a1) (BuildId: b411f547367059e067c3502d18b22db757879584)
#1 0x5a534eb25373 in std::default_delete<unsigned char>::operator()(unsigned char*) const /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99:2
#2 0x5a534eb25373 in std::unique_ptr<unsigned char, std::default_delete<unsigned char>>::~unique_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:404:4
#3 0x5a534eb23bf3 in main /home/h02332/pr-686/iccDEV/Tools/CmdLine/IccSpecSepToTiff/iccSpecSepToTiff.cpp:273:1
#4 0x76cc9da2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#5 0x76cc9da2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
#6 0x5a534ea455b4 in _start (/home/h02332/pr-686/iccDEV/Build/Tools/IccSpecSepToTiff/iccSpecSepToTiff+0x345b4) (BuildId: b411f547367059e067c3502d18b22db757879584)
0x502000000130 is located 0 bytes inside of 4-byte region [0x502000000130,0x502000000134)
allocated by thread T0 here:
#0 0x5a534eb1eb41 in operator new[](unsigned long) (/home/h02332/pr-686/iccDEV/Build/Tools/IccSpecSepToTiff/iccSpecSepToTiff+0x10db41) (BuildId: b411f547367059e067c3502d18b22db757879584)
#1 0x5a534eb22a5f in main /home/h02332/pr-686/iccDEV/Tools/CmdLine/IccSpecSepToTiff/iccSpecSepToTiff.cpp:209:45
#2 0x76cc9da2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#3 0x76cc9da2a28a in __libc_start_main csu/../csu/libc-start.c:360:3
#4 0x5a534ea455b4 in _start (/home/h02332/pr-686/iccDEV/Build/Tools/IccSpecSepToTiff/iccSpecSepToTiff+0x345b4) (BuildId: b411f547367059e067c3502d18b22db757879584)
SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/home/h02332/pr-686/iccDEV/Build/Tools/IccSpecSepToTiff/iccSpecSepToTiff+0x10e2a1) (BuildId: b411f547367059e067c3502d18b22db757879584) in operator delete(void*)
==14727==HINT: if you don't care about these errors you may set ASAN_OPTIONS=alloc_dealloc_mismatch=0
==14727==ABORTING
Contributor
Author
|
New issue, please - I'll have to chase down all the allocating paths. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
And always calculate bytesPerSample
And make the output buffer calc easier to debug
Fixes #672
Pull Request Checklist