{"record":{"id":"c3e089d051a121d8","repo":"SixLabors/ImageSharp","slug":"invalid-entry","errorCode":null,"errorMessage":"Invalid Entry.","messagePattern":"Invalid Entry\\.","errorType":"exception","errorClass":"InvalidIccProfileException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/ColorProfiles/Icc/Calculators/TrcCalculator.cs","lineNumber":30,"sourceCode":"{\n    private readonly ISingleCalculator[] calculators;\n\n    public TrcCalculator(IccTagDataEntry[] entries, bool inverted)\n    {\n        Guard.NotNull(entries, nameof(entries));\n        if (entries.Length > 4)\n        {\n            throw new InvalidIccProfileException(\"ICC conversion supports at most four tone response curves.\");\n        }\n\n        this.calculators = new ISingleCalculator[entries.Length];\n        for (int i = 0; i < entries.Length; i++)\n        {\n            this.calculators[i] = entries[i] switch\n            {\n                IccCurveTagDataEntry curve => new CurveCalculator(curve, inverted),\n                IccParametricCurveTagDataEntry parametricCurve => new ParametricCurveCalculator(parametricCurve, inverted),\n                _ => throw new InvalidIccProfileException(\"Invalid Entry.\"),\n            };\n        }\n    }\n\n    public unsafe Vector4 Calculate(Vector4 value)\n    {\n        ref float f = ref Unsafe.As<Vector4, float>(ref value);\n        for (int i = 0; i < this.calculators.Length; i++)\n        {\n            Unsafe.Add(ref f, i) = this.calculators[i].Calculate(Unsafe.Add(ref f, i));\n        }\n\n        return value;\n    }\n}\n","sourceCodeStart":12,"sourceCodeEnd":46,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/ColorProfiles/Icc/Calculators/TrcCalculator.cs#L12-L46","documentation":"In TrcCalculator's constructor, each tag entry must be either an IccCurveTagDataEntry ('curv') or IccParametricCurveTagDataEntry ('para'); anything else throws InvalidIccProfileException(\"Invalid Entry.\"). The profile supplied a tone-curve tag of an unsupported entry type where a curve was required.","triggerScenarios":"Converting with a profile whose rTRC/gTRC/bTRC or similar TRC tags contain non-curve data (e.g. mis-typed tag data or a text/descriptor entry stored under a TRC signature).","commonSituations":"Corrupt or forged ICC profiles; tag data whose embedded type signature disagrees with the tag's declared purpose; profiles assembled by broken tooling.","solutions":["Re-export the profile from a trusted tool so TRC tags contain curv/para data.","Inspect the profile's tag table (e.g. with a profile inspector) and fix or drop the offending TRC tag.","Pre-validate TRC tag entry types before conversion and reject invalid profiles."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static bool IsCurveEntry(IccTagDataEntry e) => e is IccCurveTagDataEntry or IccParametricCurveTagDataEntry;","tryCatchPattern":"try { converter.Convert(...); }\ncatch (InvalidIccProfileException ex) when (ex.Message == \"Invalid Entry.\") { logger.LogWarning(ex, \"Profile TRC tag is not a curve entry\"); /* reject profile */ }","preventionTips":["Verify each TRC tag's embedded data type is curv or para before conversion.","Re-export profiles whose tag types disagree with their tag signatures.","Run profiles through a validator (e.g. ICC profile inspection tools) on ingest."],"tags":["icc","color-management","profile-validation","csharp"],"backgroundTag":"schema-validation-failed","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"}