summaryrefslogtreecommitdiff
path: root/vcl/source/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-11 17:06:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-11 17:33:53 +0100
commit9863f7db9196a9d04790887a4c1be09240cd3d72 (patch)
tree4ac657cb47d26864c93055da9ee54923c9666693 /vcl/source/filter
parent88e1b0215b27c8897ca66509fa08b96d86023ef7 (diff)
coverity#735621 Division or modulo by zero
Change-Id: Ic92bb6946495124d50e57c2c84995cae6465af92
Diffstat (limited to 'vcl/source/filter')
-rw-r--r--vcl/source/filter/wmf/wmfwr.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/vcl/source/filter/wmf/wmfwr.cxx b/vcl/source/filter/wmf/wmfwr.cxx
index ddfa18fc0e5c..2587823356f2 100644
--- a/vcl/source/filter/wmf/wmfwr.cxx
+++ b/vcl/source/filter/wmf/wmfwr.cxx
@@ -1201,14 +1201,21 @@ void WMFWriter::WriteRecords( const GDIMetaFile & rMTF )
nLen = aTemp.getLength();
boost::scoped_array<long> pDXAry(nLen ? new long[ nLen ] : NULL);
nNormSize = pVirDev->GetTextArray( aTemp, pDXAry.get() );
- for ( i = 0; i < ( nLen - 1 ); i++ )
- pDXAry[ i ] = pDXAry[ i ] * (sal_Int32)pA->GetWidth() / nNormSize;
- if ( ( nLen <= 1 ) || ( (sal_Int32)pA->GetWidth() == nNormSize ) )
- pDXAry.reset();
- aSrcLineInfo = LineInfo();
- SetAllAttr();
- if ( !WMFRecord_Escape_Unicode( pA->GetPoint(), aTemp, pDXAry.get() ) )
- WMFRecord_ExtTextOut( pA->GetPoint(), aTemp, pDXAry.get() );
+ if (nLen && nNormSize == 0)
+ {
+ OSL_FAIL("Impossible div by 0 action: MetaStretchTextAction!");
+ }
+ else
+ {
+ for ( i = 0; i < ( nLen - 1 ); i++ )
+ pDXAry[ i ] = pDXAry[ i ] * (sal_Int32)pA->GetWidth() / nNormSize;
+ if ( ( nLen <= 1 ) || ( (sal_Int32)pA->GetWidth() == nNormSize ) )
+ pDXAry.reset();
+ aSrcLineInfo = LineInfo();
+ SetAllAttr();
+ if ( !WMFRecord_Escape_Unicode( pA->GetPoint(), aTemp, pDXAry.get() ) )
+ WMFRecord_ExtTextOut( pA->GetPoint(), aTemp, pDXAry.get() );
+ }
}
break;