summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-06-10 13:49:29 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-06-10 16:08:01 +0100
commit2fbacba2546bcbc025528e00ef4f1b2bb5950208 (patch)
treeabcea587711fa263c1610a16e1dc2a5fabd33cad /vcl
parent07dc4bc71bfa6e4f0fb042102c23c43e4268e04e (diff)
coverity#1222227 Division or modulo by zero
Change-Id: I96b74d164a582cac13c419267879619e6986d71f
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/bitmap/bitmapscalesuper.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/vcl/source/bitmap/bitmapscalesuper.cxx b/vcl/source/bitmap/bitmapscalesuper.cxx
index 95858eea5ae0..a65878ac8d26 100644
--- a/vcl/source/bitmap/bitmapscalesuper.cxx
+++ b/vcl/source/bitmap/bitmapscalesuper.cxx
@@ -762,9 +762,15 @@ void scale24bitRGB2(BitmapReadAccess* pAcc, BitmapWriteAccess* pWAcc,
else if ( nLineRange == i )
nWeightY = pMapFY[ nBottom ];
- nSumB += nWeightY * ( nSumRowB / nTotalWeightX );
- nSumG += nWeightY * ( nSumRowG / nTotalWeightX );
- nSumR += nWeightY * ( nSumRowR / nTotalWeightX );
+ if (nTotalWeightX)
+ {
+ nSumRowB /= nTotalWeightX;
+ nSumRowG /= nTotalWeightX;
+ nSumRowR /= nTotalWeightX;
+ }
+ nSumB += nWeightY * nSumRowB;
+ nSumG += nWeightY * nSumRowG;
+ nSumR += nWeightY * nSumRowR;
nTotalWeightY += nWeightY;
}