r21996 by craig - Coverity 1350114: Avoid divide by zero

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 23 11:27:57 UTC 2017


Author: craig
Date: Sun Apr 23 11:27:57 2017
New Revision: 21996

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21996
Log:
Coverity 1350114: Avoid divide by zero

Modified:
    trunk/Scribus/scribus/exif.cpp

Modified: trunk/Scribus/scribus/exif.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21996&path=/trunk/Scribus/scribus/exif.cpp
==============================================================================
--- trunk/Scribus/scribus/exif.cpp	(original)
+++ trunk/Scribus/scribus/exif.cpp	Sun Apr 23 11:27:57 2017
@@ -950,11 +950,11 @@
 		ret = false;
 	if ( ExifImageWidth != 0 && ExifImageWidth != Width )
 		ret = false;
-	if ( Thumbnail.width() == 0 || Thumbnail.height() == 0 )
+	double d = 0.0;
+	if ( Thumbnail.width() == 0 || Thumbnail.height() == 0 || Height == 0 || Width == 0 )
 		ret = false;
-	if ( Height == 0 || Width == 0 )
-		ret = false;
-	double d = ( double ) Height/Width*Thumbnail.width() /Thumbnail.height();
+	else
+		d = (double) Height/Width * Thumbnail.width()/Thumbnail.height();
 	if (!(( 1-JPEG_TOL < d ) && ( d < 1+JPEG_TOL )))
 		ret = false;
 	exifDataValid = ret;




More information about the scribus-commit mailing list