mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Add CodeQL for GitHub code scanning (#1548)
* Create codeql.yml * Addressing codeql findings
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// stdlib includes
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
// Utils-Jsonschema includes
|
||||
#include <utils/jsonschema/QJsonSchemaChecker.h>
|
||||
@@ -186,7 +186,14 @@ void QJsonSchemaChecker::checkType(const QJsonValue& value, const QJsonValue& sc
|
||||
else if (type == "integer")
|
||||
{
|
||||
if (value.isDouble()) //check if value type not boolean (true = 1 && false = 0)
|
||||
wrongType = (rint(value.toDouble()) != value.toDouble());
|
||||
{
|
||||
double valueIntegratlPart;
|
||||
double valueFractionalPart = std::modf(value.toDouble(), &valueIntegratlPart);
|
||||
if (valueFractionalPart > std::numeric_limits<double>::epsilon())
|
||||
{
|
||||
wrongType = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
wrongType = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user