[Fontconfig-bugs] [Bug 82228] 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 09:24:16 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=82228

Behdad Esfahbod <freedesktop at behdad.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Behdad Esfahbod <freedesktop at behdad.org> ---
(In reply to comment #2)
> (In reply to comment #1)
> > Thanks.  That's definitely a bug.  I'm curious to know what numbers you see
> > in the fonts though.  In the WPF Font Selection Model document, it suggest
> > that if the font value in the OpenType OS/2 table is 1 to 9, then multiply
> > it by 100.  I think I agree with that.  Now that you have seen this in the
> > wild, what kind of values are out there?
> 
> To be honest only saw it through looking through source code changes,

Oh that's really comforting to know someone's reading the code :).

> haven't hit it with any fonts yet. Looks like my bug though is a duplicate,
> just noticed bug 82220 which appears to be the same issue and has sample
> font attached that triggers it.

Ok, I'll do a survey of fonts I have access to and adjust.  Fix the crash for
now:

commit 01bb6978b6389852c5259b135af45ecdfe9f42f8
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Aug 6 12:23:24 2014 -0400

    Fix assertion failure

    https://bugs.freedesktop.org/show_bug.cgi?id=82220
    https://bugs.freedesktop.org/show_bug.cgi?id=82228

diff --git a/src/fcweight.c b/src/fcweight.c
index c62f807..313f3f2 100644
--- a/src/fcweight.c
+++ b/src/fcweight.c
@@ -45,7 +45,7 @@ static int lerp(int x, int x1, int x2, int y1, int y2)
 {
   int dx = x2 - x1;
   int dy = y2 - y1;
-  assert (dx > 0 && dy > 0 && x1 <= x && x <= x2);
+  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/591546d7/attachment.html>


More information about the Fontconfig-bugs mailing list