Harden mergeTiffParts against part files missing geometry tags (SIGFPE)#1082
Open
robert-kofler42 wants to merge 1 commit into
Open
Harden mergeTiffParts against part files missing geometry tags (SIGFPE)#1082robert-kofler42 wants to merge 1 commit into
robert-kofler42 wants to merge 1 commit into
Conversation
mergeTiffParts read TIFFTAG_IMAGEWIDTH/IMAGELENGTH/TILEWIDTH/TILELENGTH (and bps/spp/sf/comp) from the first part file into uninitialized locals without checking the TIFFGetField return value. A part file from a killed or corrupt distributed render job can be missing those tags; in particular a stripped (non-tiled) TIFF has no TILEWIDTH/TILELENGTH, leaving tw/th uninitialized, and the tile grid computation `(w + tw - 1) / tw` then divides by zero — a SIGFPE that takes down the whole merge. Initialize the geometry/format locals to 0, require the four geometry tags via the TIFFGetField return value, and skip the group (count it as a failure and continue) when any are missing or zero, instead of crashing. Adds a test_tiff_merge case that writes a stripped part TIFF and merges it: the unfixed merge SIGFPEs (signal 8), the hardened one returns false and writes nothing. Existing happy-path merge tests still pass.
|
Someone is attempting to deploy a commit to the scroll Team on Vercel. A member of the Team first needs to authorize it. |
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.
Bug
mergeTiffParts(used by the distributedvc_render_tifxyzmerge step) reads the geometry/format tags from the first part file into uninitialized locals without checking theTIFFGetFieldreturn value:A part file from a killed or corrupt distributed render job can be missing those tags. In particular a stripped (non-tiled) TIFF has no
TILEWIDTH/TILELENGTH, sotw/thstay uninitialized and the tile-grid computation(w + tw - 1) / twdivides by zero — a SIGFPE that takes down the whole merge.Fix
Initialize the geometry/format locals to 0, require the four geometry tags via the
TIFFGetFieldreturn value, and skip the group (count it as a failure andcontinue) when any are missing or zero — instead of crashing.Verification
Adds a
test_tiff_mergecase that writes a stripped part TIFF and merges it:Tiff.cpp;false, writes nothing, no crash.Existing happy-path merge tests still pass (3/3).
Found via a parser-hardening audit; this is the one finding in the actively-used
volume-cartographercore (the others are in thevesuvius-chelper library and are being handled separately).🤖 Generated with Claude Code