{"record":{"id":"e2baf971ce88e084","repo":"SixLabors/ImageSharp","slug":"curve-has-to-be-either-icctypesignature-curve-or","errorCode":null,"errorMessage":"Curve has to be either \"{IccTypeSignature}.{Curve}\" or \"{IccTypeSignature}.{ParametricCurve}\" for LutAToB- and LutBToA-TagDataEntries","messagePattern":"Curve has to be either \"(.+?)\\.(.+?)\" or \"(.+?)\\.(.+?)\" for LutAToB- and LutBToA-TagDataEntries","errorType":"exception","errorClass":"InvalidIccProfileException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs","lineNumber":200,"sourceCode":"        }\n\n        return new IccSampledCurveElement(entries);\n    }\n\n    /// <summary>\n    /// Reads curve data\n    /// </summary>\n    /// <param name=\"count\">Number of input channels</param>\n    /// <returns>The curve data</returns>\n    private IccTagDataEntry[] ReadCurves(int count)\n    {\n        IccTagDataEntry[] tdata = new IccTagDataEntry[count];\n        for (int i = 0; i < count; i++)\n        {\n            IccTypeSignature type = this.ReadTagDataEntryHeader();\n            if (type != IccTypeSignature.Curve && type != IccTypeSignature.ParametricCurve)\n            {\n                throw new InvalidIccProfileException($\"Curve has to be either \\\"{nameof(IccTypeSignature)}.{nameof(IccTypeSignature.Curve)}\\\" or\" +\n                    $\" \\\"{nameof(IccTypeSignature)}.{nameof(IccTypeSignature.ParametricCurve)}\\\" for LutAToB- and LutBToA-TagDataEntries\");\n            }\n\n            if (type == IccTypeSignature.Curve)\n            {\n                tdata[i] = this.ReadCurveTagDataEntry();\n            }\n            else if (type == IccTypeSignature.ParametricCurve)\n            {\n                tdata[i] = this.ReadParametricCurveTagDataEntry();\n            }\n\n            this.AddPadding();\n        }\n\n        return tdata;\n    }\n}","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Metadata/Profiles/ICC/DataReader/IccDataReader.Curves.cs#L182-L218","documentation":"This error is thrown while reading an ICC profile's lutAToB or lutBToA tag. Each element of the LUT's pipeline (B curves, matrix, M curves, A curves) must be encoded as either a 'curve' or 'parametricCurve' type tag data entry. If the reader encounters any other type signature (e.g. multiLocalizedUnicode, lut16, or a corrupt signature), it declares the profile invalid and stops.","triggerScenarios":"Calling the ICC profile parsing API (e.g. new IccProfile(bytes) or IccReader.Read) on a profile whose lutAToBType/lutBToAType tag contains an element with a type signature other than curveType or parametricCurveType, or on a profile whose tag data is truncated/corrupt so the signature bytes decode as an unexpected value.","commonSituations":"Processing third-party or device-generated ICC profiles that embed unsupported element types inside LUT tags; loading truncated or bit-corrupted profile files; hand-modified profile binaries; profiles from obscure vendors that put non-standard elements in LUT tags.","solutions":["Re-export or regenerate the ICC profile from the original device or profiling tool with standard curve/parametricCurve elements.","Verify the profile passes an external validator (e.g. ICC profile verification tools) before loading it with ImageSharp.","Check the profile file is not truncated - the byte count in the tag table must match actual data length.","If you control the source profile, use a profile editor (e.g. littleCMS tooling) to rewrite the LUT with curveType elements."],"exampleFix":"// before: blindly parsing any profile byte blob\nvar profile = new IccProfile(suspectBytes);\n\n// after: validate via try-catch and reject bad profiles\ntry\n{\n    var profile = new IccProfile(suspectBytes);\n}\ncatch (InvalidIccProfileException ex)\n{\n    logger.LogWarning(ex, \"Invalid ICC profile, skipping color correction\");\n}","handlingStrategy":"try-catch","validationCode":"// Validate profile bytes are non-trivial and wrap parsing\nif (iccBytes == null || iccBytes.Length < 128)\n    throw new InvalidDataException(\"ICC data too short to be a profile\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var profile = new IccProfile(iccBytes);\n}\ncatch (InvalidIccProfileException ex)\n{\n    logger.LogWarning(ex, \"ICC profile rejected: invalid curve element in LUT tag\");\n    // fall back to default profile or skip color management\n}","preventionTips":["Validate profiles with an ICC conformance tool before bulk processing","Reject truncated files by checking tag table offsets against file length","Keep a known-good default profile as fallback","Log the failing tag signature to identify the offending vendor tool"],"tags":["icc","color-management","profile-validation"],"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"}