blob: 8232e21cc7e7cf2afc6a46610903a5e046a15d28 [file] [log] [blame] [edit]
diff --git a/third_party/lcms/src/cmsopt.c b/third_party/lcms/src/cmsopt.c
index e3212fb4d..a5475709b 100644
--- a/third_party/lcms/src/cmsopt.c
+++ b/third_party/lcms/src/cmsopt.c
@@ -100,6 +100,15 @@ typedef struct {
} Curves16Data;
+// A simple adapter to prevent _cmsPipelineEval16Fn vs. _cmsInterpFn16
+// confusion, which trips up UBSAN.
+static
+void Lerp16Adapter(CMSREGISTER const cmsUInt16Number in[],
+ CMSREGISTER cmsUInt16Number out[],
+ const void* data) {
+ cmsInterpParams* params = (cmsInterpParams*)data;
+ params->Interpolation.Lerp16(in, out, params);
+}
// Simple optimizations ----------------------------------------------------------------------------------------------------------
@@ -805,7 +814,7 @@ Error:
if (DataSetIn == NULL && DataSetOut == NULL) {
- _cmsPipelineSetOptimizationParameters(Dest, (_cmsPipelineEval16Fn) DataCLUT->Params->Interpolation.Lerp16, DataCLUT->Params, NULL, NULL);
+ _cmsPipelineSetOptimizationParameters(Dest, Lerp16Adapter, DataCLUT->Params, NULL, NULL);
}
else {