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

Caolán McNamara caolanm at redhat.com
Tue Sep 29 04:13:24 PDT 2015


 vcl/source/glyphs/graphite_layout.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit d62dddd6345e8f1730eed1bb2b7183499a85133f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 29 12:09:33 2015 +0100

    coverity#1325059 Argument cannot be negative bodge
    
    Change-Id: I9bae22c7420247a26f0fe73e6c4e590471f19b0e

diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 635417b..10be4a0 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -689,6 +689,12 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
 
     for (int i = startGi; i < endGi; ++i)
     {
+        if (i < 0)
+        {
+            SAL_WARN( "vcl.gdi", "Negative index" );
+            continue;
+        }
+
         // calculate visual cluster bounds
         int firstChar = mvGlyph2Char[i];
         int nBaseGlyph = mvChar2BaseGlyph[firstChar - mnMinCharPos];
commit 4fd693f718ac74115ea58208ac3427c01857d260
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 29 12:07:20 2015 +0100

    coverity#1325060 Argument cannot be negative bodge
    
    Change-Id: Iee72d75a5609aa6e1098723ff62928bd47b42072

diff --git a/vcl/source/glyphs/graphite_layout.cxx b/vcl/source/glyphs/graphite_layout.cxx
index 305a5d4..635417b 100644
--- a/vcl/source/glyphs/graphite_layout.cxx
+++ b/vcl/source/glyphs/graphite_layout.cxx
@@ -739,6 +739,12 @@ void GraphiteLayout::ApplyDXArray(ImplLayoutArgs &args, std::vector<int> & rDelt
         for (int n = i; n < nLastGlyph; n++)
             mvGlyphs[n].maLinearPos.X() += (nDGlyphOrigin + nDWidth) * (bRtl ? -1 : 1);
 
+        if (nBaseGlyph < 0)
+        {
+            SAL_WARN( "vcl.gdi", "Negative BaseGlyph" );
+            continue;
+        }
+
         rDeltaWidth[nBaseGlyph] = nDWidth;
 #ifdef GRLAYOUT_DEBUG
         fprintf(grLog(),"c%d=%d g%d-%d dW%ld-%ld=%ld dX%ld x%ld @%d=%d\n", firstChar, lastChar, i, nLastGlyph, nNewClusterWidth, nOrigClusterWidth, nDWidth, nDGlyphOrigin, mvGlyphs[i].maLinearPos.X(), mvCharDxs[lastChar - mnMinCharPos], args.mpDXArray[lastChar - args.mnMinCharPos]);


More information about the Libreoffice-commits mailing list