[cairo-bugs] [Bug 74779] Segmentation fault when using a complex path for clip and stroke
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Fri Aug 8 03:55:42 PDT 2014
https://bugs.freedesktop.org/show_bug.cgi?id=74779
--- Comment #7 from Massimo <sixtysix at inwind.it> ---
Created attachment 104274
--> https://bugs.freedesktop.org/attachment.cgi?id=104274&action=edit
patch to add an assert to verify an assumption
Judging from the comment and the code at (where 'exactness' is used):
http://cgit.freedesktop.org/cairo/tree/src/cairo-polygon-intersect.c?id=7e856071a27b06a6ae35b6445635da9276975c69#n665
it seems you want to compute the ordinate of an intersection rounded
toward -oo with the unused remainder non-negative.
adding an assert to verify this happens (as in the attached patch)
num = q * den + r
-> r = num - q * den
-> r >= 0
-> num >= q * den
it is evident from its failure when running the 'creduced' test case
intersect_lines: Assertion `(!((det64x32_128 (a_det, dx1, b_det, dx2)) <
(((int128_t) (qr.quo) * (den_det)))))' failed.
that when the computed remainder is not zero not always a > b
In case comments are old and misleading and you want to round to the nearest
integer I suspect the code computing the ordinate is anyway wrong:
for example when
http://cgit.freedesktop.org/cairo/tree/src/cairo-polygon-intersect.c?id=7e856071a27b06a6ae35b6445635da9276975c69#n608
den64x32 = 16
den_det = -5
16 / -5 = -3.2
qr initially is {-3, 1} because 16 == -3 * -5 + 1
but den_det and qr.rem have different signs so qr.rem is
negated and doubled -> qr = { -3, -2 }
because now qr.rem >= den_det (-2 >= -5) qr.quo is decremented
to -4, which is not the nearest integer approximating -3.2
~
--
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20140808/c4db7a14/attachment.html>
More information about the cairo-bugs
mailing list