Skip to content

Commit f353127

Browse files
author
aothms
committed
No longer accept and silently convert invalid REAL tokens to zero
1 parent ffe1edd commit f353127

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/ifcparse/IfcParse.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,11 @@ bool TokenFunc::asBool(const Token& t) {
348348
}
349349
double TokenFunc::asFloat(const Token& t) {
350350
const std::string str = asString(t);
351-
return (double) atof(str.c_str());
351+
const char* start = str.c_str();
352+
char* end;
353+
double result = strtod(start,&end);
354+
if ( start == end ) throw IfcException("Token is not a real");
355+
return result;
352356
}
353357
std::string TokenFunc::asString(const Token& t) {
354358
if ( isOperator(t,'$') ) return "";

0 commit comments

Comments
 (0)