[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann sbergman at redhat.com
Mon Jun 19 09:25:45 UTC 2017


 vcl/source/fontsubset/sft.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d3e0ab976a5bbf63d1673422035def67ba9f4838
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jun 19 11:19:19 2017 +0200

    Avoid -fsanitize=shift-base about left-shift of negative values
    
    ...assuming these values are indeed intended to be negative (and <https:
    //developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6.html#Types>)
    mentions a "Fixed: 16.16-bit sgined fixed-point number" type, apparently
    represented here by F16Dot16, so the assumption looks plausible).
    
    During CppunitTest_vcl_pdfexport, encountered negative values -1184 and -22 with
    instdir/share/fonts/truetype/Carlito-Regular.ttf and -8 with
    instdir/share/fonts/truetype/LiberationSans-Bold.ttf.
    
    Change-Id: Ia07c61aebc2c9c67d0ed6173ecac94bab2abb2a8

diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 20620ea19f1f..b925846dac14 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -620,9 +620,9 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
                 cp.flags = nextComponent[i].flags;
                 const sal_uInt16 x = nextComponent[i].x;
                 const sal_uInt16 y = nextComponent[i].y;
-                t = fixedMulDiv(a, x << 16, m) + fixedMulDiv(c, y << 16, m) + (e << 16);
+                t = fixedMulDiv(a, x << 16, m) + fixedMulDiv(c, y << 16, m) + sal_Int32(sal_uInt16(e) << 16);
                 cp.x = (sal_Int16)(fixedMul(t, m) >> 16);
-                t = fixedMulDiv(b, x << 16, n) + fixedMulDiv(d, y << 16, n) + (f << 16);
+                t = fixedMulDiv(b, x << 16, n) + fixedMulDiv(d, y << 16, n) + sal_Int32(sal_uInt16(f) << 16);
                 cp.y = (sal_Int16)(fixedMul(t, n) >> 16);
 
                 myPoints.push_back( cp );


More information about the Libreoffice-commits mailing list