[Fontconfig-bugs] [Bug 82228] New: OpenType weight between 0 and 100 could result in assertion in FcWeightFromOpenType
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Wed Aug 6 00:04:29 PDT 2014
https://bugs.freedesktop.org/show_bug.cgi?id=82228
Priority: medium
Bug ID: 82228
Assignee: fontconfig-bugs at lists.freedesktop.org
Summary: OpenType weight between 0 and 100 could result in
assertion in FcWeightFromOpenType
QA Contact: freedesktop at behdad.org
Severity: normal
Classification: Unclassified
OS: All
Reporter: daphnediane at mac.com
Hardware: Other
Status: NEW
Version: unspecified
Component: library
Product: fontconfig
Calling FcWeightFromOpenType with ot_weight between 1 and 99 triggers an
assertion. lerp will get called with x = ot_weight, x1 = 0, x2 = 100, y1 = 0,
y2 = 0. It will then compute dy = y2 - y1 = 0. Which will cause assert ( dx > 0
&& dy > 0 && x1 <= x && x <= x2 ) to fail as dy is 0. Seems like if dy == 0,
then it should return y1.
Possible patch
diff --git a/src/fcweight.c b/src/fcweight.c
index 87bbe67..4def775 100644
--- a/src/fcweight.c
+++ b/src/fcweight.c
@@ -45,6 +45,7 @@ static int lerp(int x, int x1, int x2, int y1, int y2)
{
int dx = x2 - x1;
int dy = y2 - y1;
+ if (dy == 0 && x1 <= x && x <= x2) return y1;
assert (dx > 0 && dy > 0 && x1 <= x && x <= x2);
return y1 + (dy*(x-x1) + dx/2) / dx;
}
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/fontconfig-bugs/attachments/20140806/bddb4428/attachment.html>
More information about the Fontconfig-bugs
mailing list