{"record":{"id":"7e71c2a10308fe53","repo":"SixLabors/ImageSharp","slug":"invalid-curve-segment-type-of-signature","errorCode":null,"errorMessage":"Invalid curve segment type of {signature}","messagePattern":"Invalid curve segment type of (.+?)","errorType":"exception","errorClass":"InvalidIccProfileException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs","lineNumber":134,"sourceCode":"    }\n\n    /// <summary>\n    /// Reads a <see cref=\"IccCurveSegment\"/>\n    /// </summary>\n    /// <returns>The read segment</returns>\n    public IccCurveSegment ReadCurveSegment()\n    {\n        IccCurveSegmentSignature signature = (IccCurveSegmentSignature)this.ReadUInt32();\n        this.AddIndex(4);   // 4 bytes reserved\n\n        switch (signature)\n        {\n            case IccCurveSegmentSignature.FormulaCurve:\n                return this.ReadFormulaCurveElement();\n            case IccCurveSegmentSignature.SampledCurve:\n                return this.ReadSampledCurveElement();\n            default:\n                throw new InvalidIccProfileException($\"Invalid curve segment type of {signature}\");\n        }\n    }\n\n    /// <summary>\n    /// Reads a <see cref=\"IccFormulaCurveElement\"/>\n    /// </summary>\n    /// <returns>The read segment</returns>\n    public IccFormulaCurveElement ReadFormulaCurveElement()\n    {\n        IccFormulaCurveType type = (IccFormulaCurveType)this.ReadUInt16();\n        this.AddIndex(2);   // 2 bytes reserved\n        float gamma, a, b, c, d, e;\n        gamma = d = e = 0;\n\n        if (type == IccFormulaCurveType.Type1 || type == IccFormulaCurveType.Type2)\n        {\n            gamma = this.ReadSingle();\n        }","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs#L116-L152","documentation":"ReadCurveSegment dispatches on the curve segment's signature; ICC profiles only define FormulaCurve and SampledCurve segment types. Any other signature means the multi-dimensional/one-dimensional curve element in the profile is nonconformant, so InvalidIccProfileException is thrown.","triggerScenarios":"Loading an ICC profile containing a multiProcess/multiLocalized or 'curve segment' structure (e.g. inside MAB/MBA tags) whose segment signature is neither 'parf' (formula) nor 'curv'-style sampled — corrupt or vendor-broken profiles.","commonSituations":"Images carrying ICC v4/v5 (iccMAX) style profiles with segment types ImageSharp doesn't recognize; corrupted color profiles; profiles generated by tools writing unknown signatures.","solutions":["Replace the offending ICC profile with a standard one (sRGB/Adobe RGB) and re-save the image.","Catch InvalidIccProfileException and continue without applying that profile's color transform.","Verify the profile externally (ICC Profile Inspector, color.org validators) to confirm nonconformance, then regenerate it with conformant tooling."],"exampleFix":"// before\nusing var image = Image.Load(path); // throws on unknown curve segment signature\n// after\ntry\n{\n    using var image = Image.Load(path);\n}\ncatch (InvalidIccProfileException ex)\n{\n    logger.LogWarning(\"Skipping image with bad ICC curve segment: {Msg}\", ex.Message);\n    return; // or reprocess after stripping the profile\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { using var image = Image.Load(path); }\ncatch (InvalidIccProfileException ex) when (ex.Message.Contains(\"curve segment\"))\n{ /* fall back to unmanaged color or strip/reassign the profile */ }","preventionTips":["Avoid feeding iccMAX/v5 profiles to pipelines expecting standard ICC v2/v4 support.","Re-embed known-good profiles (sRGB) during ingestion normalization.","Log the offending signature to identify the producing tool and fix it at the source."],"tags":["icc","color-profile","corrupt-input","parsing"],"backgroundTag":"invalid-enum-value","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"}