Closed cgohlke closed 11 months ago
Thanks for reporting. I'm taking a look and eventually could create a 2.16.1 to fix the issue
The stride needs to be corrected like in the other, similar functions: Stride /= PixelSize(info->OutputFormat);
.
I see it's already fixed in master. Thank you.
Should I create a 2.16.1? I realize that could be a stopper for your package. Just let me know.
Not really a showstopper for me. I can build against a patched version of lcms2 if necessary. On the other hand, known access violations might pose a security risk so it's probably a good idea to release the fix soonish.
Are there any known limitations using half floats (float16) in lcms? I get some crashes during the imagecodecs tests when enabling half floats. Is that worth investigating and opening another issue?
This fixes the segfaults with float16 formats for me:
diff --git a/src/cmspack.c b/src/cmspack.c
index c191896..a594a3d 100644
--- a/src/cmspack.c
+++ b/src/cmspack.c
@@ -3426,7 +3428,7 @@ cmsUInt8Number* UnrollHalfToFloat(_cmsTRANSFORM* info,
cmsUInt32Number i, start = 0;
cmsFloat32Number maximum = IsInkSpace(info ->InputFormat) ? 100.0F : 1.0F;
- Stride /= PixelSize(info->OutputFormat);
+ Stride /= PixelSize(info->InputFormat);
if (ExtraFirst)
start = Extra;
Are there any known limitations using half floats (float16) in lcms?
All transforms seem to work now from/to half float, except output to planar half float, which fails with "Unsupported raster format".
This fixes the segfaults with float16 formats for me:
That is a bug, thanks for finding it. I'm fixing it in e88056ef81e42cd1fe06945da9d44ac95c80fa48
All transforms seem to work now from/to half float, except output to planar half float, which fails with "Unsupported raster format".
yes, that's not implemented.
Hello. First of all, thank you for developing and maintaining this library!
After upgrading to lcms2-2.16 from 2.15, I get reproducible crashes (Windows fatal exception: access violation) during the tests of the imagecodecs Python library.
lcms2-2.16 was built from source using the VS2022 solutions on Windows 11. Visual Studio 2022 is at version 17.8.3.
The crash occurs when transforming
float32
orfloat64
sRGB images touint16
planar sRGB at https://github.com/mm2/Little-CMS/blob/453bafeb85b4ef96498866b7a8eadcc74dff9223/src/cmspack.c#L3038The call stack is:
This is related to commit https://github.com/mm2/Little-CMS/commit/4c0c66e7109a903c470159ecd3d753e8a4d56c79.
lcms2-2.15 or other transforms (for example, to non-planar or uint8) do not crash.
If necessary, I can try to create a standalone example or debug build.
Unrelated: the CPython headers define a conflicting
T_FLOAT
macro at https://github.com/python/cpython/blob/v3.12.1/Include/structmember.h#L27. Hence, the lcms2T_FLOAT
macro cannot be used in Python bindings.