Skip to content

Commit f23d965

Browse files
Add limits check: Exif.NikonFl7.FlashCompensation
1 parent f0f3c7e commit f23d965

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/nikonmn_int.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <cstring>
4040
#include <math.h> //for log, pow, abs
4141
#include <cmath>
42+
#include <limits>
4243

4344
// *****************************************************************************
4445
// class member definitions
@@ -2928,11 +2929,13 @@ fmountlens[] = {
29282929

29292930
if (temp == 0)
29302931
os << 0;
2932+
else if ( std::numeric_limits<float>::min() > temp && temp > std::numeric_limits<float>::max() )
2933+
os << "(" << value << ")";
29312934
else if ( (int(temp)/temp) > 0.999 )
29322935
os << int(temp);
2933-
else if ( (int(temp*2)/(temp*2)) > 0.999 )
2936+
else if ( std::numeric_limits<float>::min() <= (temp*2) && (temp*2) <= std::numeric_limits<float>::max() && ((int(temp*2)/(temp*2)) > 0.999) )
29342937
os << int(temp)*2 << "/2";
2935-
else if ( (int(temp*3)/(temp*3)) > 0.999 )
2938+
else if ( std::numeric_limits<float>::min() <= (temp*3) && (temp*3) <= std::numeric_limits<float>::max() && ((int(temp*3)/(temp*3)) > 0.999) )
29362939
os << int(temp)*3 << "/3";
29372940
else
29382941
os << std::setprecision(3) << temp;

0 commit comments

Comments
 (0)