{"record":{"id":"3c796fc1f077a4dc","repo":"SixLabors/ImageSharp","slug":"invalid-tiff-icc-profile","errorCode":null,"errorMessage":"Invalid TIFF ICC profile.","messagePattern":"Invalid TIFF ICC profile\\.","errorType":"exception","errorClass":"InvalidIccProfileException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs","lineNumber":302,"sourceCode":"        ImageFrameMetadata imageFrameMetaData = new();\n        if (!this.skipMetadata)\n        {\n            imageFrameMetaData.ExifProfile = tags;\n\n            // We resolve the ICC profile early so that we can use it for color conversion if needed.\n            if (tags.TryGetValue(ExifTag.IccProfile, out IExifValue<byte[]> iccProfileBytes))\n            {\n                this.ExecuteAncillarySegmentAction(\n                    () =>\n                    {\n                        IccProfile profile = new(iccProfileBytes.Value);\n                        if (profile.CheckIsValid())\n                        {\n                            imageFrameMetaData.IccProfile = profile;\n                        }\n                        else\n                        {\n                            throw new InvalidIccProfileException(\"Invalid TIFF ICC profile.\");\n                        }\n                    });\n            }\n        }\n\n        TiffFrameMetadata tiffMetadata = TiffFrameMetadata.Parse(tags);\n        imageFrameMetaData.SetFormatMetadata(TiffFormat.Instance, tiffMetadata);\n\n        return (imageFrameMetaData, tiffMetadata);\n    }\n\n    /// <summary>\n    /// Decodes the image data for Tiff's which arrange the pixel data in stripes.\n    /// </summary>\n    /// <typeparam name=\"TPixel\">The pixel format.</typeparam>\n    /// <param name=\"tags\">The IFD tags.</param>\n    /// <param name=\"frame\">The image frame to decode into.</param>\n    /// <param name=\"width\">The width in px units of the frame data.</param>","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs#L284-L320","documentation":"When building TIFF frame metadata, the decoder reads the embedded ICC profile tag and validates it with CheckIsValid(). If the profile fails validation (bad header, wrong size, malformed data), it throws InvalidIccProfileException instead of attaching a broken profile.","triggerScenarios":"Image.Load/Identify of a TIFF whose ICC profile tag (34675) contains bytes that fail ICC profile validation — bad header signature, invalid size fields, or truncated profile data.","commonSituations":"Files color-managed by tools that wrote truncated or malformed ICC blobs; profiles stripped/re-embedded incorrectly by third-party software; corrupted downloads.","solutions":["Strip or replace the broken ICC profile: e.g. exiftool '-icc_profile<' or tiffcp (dropping custom tags) to produce a clean file.","Embed a known-good ICC profile with exiftool/icc-tool and reload.","Catch InvalidIccProfileException and load while ignoring color management (ImageData may still be read by other decoders)."],"exampleFix":"// before\nusing var image = Image.Load(path); // InvalidIccProfileException\n// after\ntry\n{\n    using var image = Image.Load(path);\n}\ncatch (InvalidIccProfileException)\n{\n    // proceed without embedded profile or repair it externally:\n    // exiftool \"-icc_profile=\" path\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    using var img = Image.Load(path);\n}\ncatch (InvalidIccProfileException)\n{\n    // drop or repair the profile: exiftool \"-icc_profile=\" path, then retry\n}","preventionTips":["Validate embedded ICC blobs at ingest with a profile validator","Strip ICC profiles from untrusted sources before processing","Verify file integrity after transfer — truncation corrupts profile data"],"tags":["tiff","icc-profile","decoding","metadata"],"backgroundTag":"checksum-mismatch","analyzedSha":"59ce6af6fc29027cda277ef62d4d1694a8acce91","analyzedAt":"2026-09-13T18:34:59.331Z","contentChangedAt":"2026-09-13T18:34:59.331Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}