Add CodeQL for GitHub code scanning (#1548)

* Create codeql.yml

* Addressing codeql findings
This commit is contained in:
LordGrey
2022-12-27 08:36:10 +01:00
committed by GitHub
parent 1189f86c1a
commit 6fa7bab6f7
83 changed files with 1984 additions and 2094 deletions

View File

@@ -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;
}