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

David Tardon dtardon at redhat.com
Fri Oct 17 05:07:13 PDT 2014


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

New commits:
commit 991fb393678f8b7893c9e3c74ecd1401417067cb
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Oct 17 14:05:03 2014 +0200

    coverity#735653 avoid division by 0
    
    Change-Id: Ie3ec074292467f096e69142dc599b0e29e1e7f7b

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index df914a5..d03b321 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1191,7 +1191,7 @@ void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, s
 
         Rectangle aClip( aPos, aSize );
         pDev->IntersectClipRegion( aClip );
-        sal_uInt16 nLines = (sal_uInt16) ( (aSize.Height()-nEditHeight) / nTextHeight );
+        sal_uInt16 nLines = (sal_uInt16) ( ( nTextHeight > 0 ) ? ( (aSize.Height()-nEditHeight) / nTextHeight ) : 1 );
         if ( !nLines )
             nLines = 1;
         sal_uInt16 nTEntry = IsReallyVisible() ? mpImplLB->GetTopEntry() : 0;
commit 3dcbcd120c2b42e291f6ec65db7b824cf7acd4f7
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Oct 17 14:02:36 2014 +0200

    coverity#735654 avoid division by 0
    
    Change-Id: If368d300c5ed880e1359cbc67df0e13b00fc6ecf

diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 857e389..df914a5 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -1114,7 +1114,7 @@ void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines
     else
     {
         Size aOutSz = mpSubEdit->GetOutputSizePixel();
-        rnCols = (sal_uInt16)(aOutSz.Width()/nCharWidth);
+        rnCols = (nCharWidth > 0) ? (sal_uInt16)(aOutSz.Width()/nCharWidth) : 1;
         rnLines = 1;
     }
 }


More information about the Libreoffice-commits mailing list