diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-01-27 14:37:28 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-01-27 14:38:40 +0000 |
commit | c1b7a2feb435d8e738e0636d58f027c5db4e8201 (patch) | |
tree | 95ac12eefffedf91453072c4f0caf182e2572eab /basebmp | |
parent | 6b44c30bcb1f8387fd1848d0052cc809600950f4 (diff) |
coverity#1078535 Division or modulo by zero
Change-Id: Iab9bb56ce7646955d2592d7e9abdaf829ee1ec78
Diffstat (limited to 'basebmp')
-rw-r--r-- | basebmp/source/bitmapdevice.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx index 4b86231e6288..f1d0c2b2ba3a 100644 --- a/basebmp/source/bitmapdevice.cxx +++ b/basebmp/source/bitmapdevice.cxx @@ -1462,8 +1462,16 @@ namespace const ::basegfx::B2IBox& rSourceBounds ) { // extract inherent scale - const double nScaleX( io_rDestArea.getWidth() / (double)io_rSourceArea.getWidth() ); - const double nScaleY( io_rDestArea.getHeight() / (double)io_rSourceArea.getHeight() ); + double fWidth = io_rSourceArea.getWidth(); + if (fWidth == 0.0) + return false; + + double fHeight = io_rSourceArea.getHeight(); + if (fHeight == 0.0) + return false; + + const double nScaleX( io_rDestArea.getWidth() / fWidth ); + const double nScaleY( io_rDestArea.getHeight() / fHeight ); // extract range origins const basegfx::B2IPoint aDestTopLeft( |