https://bugs.winehq.org/show_bug.cgi?id=51139
--- Comment #20 from Henri Verbeet hverbeet@gmail.com --- (In reply to Dieter Jurzitza from comment #16)
I tried to guess from ms' patch what is the culprit and tried to change the code a such for futher testing:
--- dlls/d2d1/geometry.c.original 2021-07-20 22:09:28.000000000 +0200 +++ dlls/d2d1/geometry.c 2021-07-30 21:51:31.768045816 +0200 @@ -1708,12 +1708,21 @@ { D2D1_POINT_2F intersection; float t;
- double delta=0;
- d2d_point_calculate_bezier(&intersection, p[0], p[1], p[2], s);
- if (fabsf(q[1]->x - q[0]->x) > fabsf(q[1]->y - q[0]->y))
t = (intersection.x - q[0]->x) / (q[1]->x - q[0]->x);
- else
t = (intersection.y - q[0]->y) / (q[1]->y - q[0]->y);
- if (fabsf(q[1]->x - q[0]->x) > fabsf(q[1]->y - q[0]->y)){
delta=(q[1]->x - q[0]->x);
if (delta < 1.0e-12)
delta=1.0e-12;
t = (intersection.x - q[0]->x) / delta;
- }
- else {
delta = (q[1]->y - q[0]->y);
if (delta < 1.0e-12)
delta=1.0e-12;
t = (intersection.y - q[0]->y) / delta;
- } if (t < 0.0f || t > 1.0f) return TRUE;
thereby trying to avoid a divide - by - zero situation. However, this did not change anything in regards to the system behavior and the bug apparently remained "as is", wine crashing after messaging that a severe error had occured. I guess my assumption is wrong - would some kind soul direct me to the right place that needs modification?
Well, the issue is more with the numerator than with the denominator in that code. E.g. for "t = 1.0f / 0.0f" we'd get "t = +INF", but the rest of the code would handle that fine. The issue is specifically "t = 0.0f / 0.0f" giving us "t = NAN". The right answer in that case is "t = 0.0f". (Or "t = 1.0f"; it doesn't really matter.)
The real question then becomes whether a zero-length segment can legitimately occur here, or if that's simply caused by a bug elsewhere.
(In reply to Nikolay Sivov from comment #18)
We'll need a data set to recreate such geometry as a test case, so this could be solved properly.
Does the testcase from ms in comment 14 (I haven't looked myself yet, but thanks for that) work for you?