diff --git a/cfg/cppcheck-cfg.rng b/cfg/cppcheck-cfg.rng
index 9864ba111..cd79f5975 100644
--- a/cfg/cppcheck-cfg.rng
+++ b/cfg/cppcheck-cfg.rng
@@ -228,8 +228,8 @@
-
- (-?[0-9]*(\.[0-9]+)?[,:])*([-]?[0-9]+(\.[0-9]+)?)?
+
+ (-?[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?[,:])*([-]?[0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?)?
diff --git a/cfg/std.cfg b/cfg/std.cfg
index 17a37a375..eb9a0f5a7 100644
--- a/cfg/std.cfg
+++ b/cfg/std.cfg
@@ -3173,6 +3173,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
+ 4.94066e-324:
@@ -3183,6 +3184,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
+ 1.4013e-45:
@@ -3193,6 +3195,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
+ 4.94066e-324:
@@ -3494,6 +3497,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
+ 4.94066e-324:
@@ -3505,6 +3509,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
+ 1.4013e-45:
@@ -3516,6 +3521,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
+ 4.94066e-324:
@@ -3560,6 +3566,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
+ 4.94066e-324:
@@ -3571,6 +3578,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
+ 1.4013e-45:
@@ -3582,6 +3590,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
+ 4.94066e-324:
diff --git a/lib/library.cpp b/lib/library.cpp
index 18642bab4..cb955063e 100644
--- a/lib/library.cpp
+++ b/lib/library.cpp
@@ -711,6 +711,7 @@ Library::Error Library::loadFunction(const tinyxml2::XMLElement * const node, co
bool error = false;
bool range = false;
bool has_dot = false;
+ bool has_E = false;
if (!p)
return Error(BAD_ATTRIBUTE_VALUE, "\"\"");
@@ -723,15 +724,20 @@ Library::Error Library::loadFunction(const tinyxml2::XMLElement * const node, co
error |= range | (*(p+1) == '.');
range = true;
has_dot = false;
+ has_E = false;
} else if (*p == '-')
error |= (!std::isdigit(*(p+1)));
else if (*p == ',') {
range = false;
error |= *(p+1) == '.';
has_dot = false;
+ has_E = false;
} else if (*p == '.') {
error |= has_dot | (!std::isdigit(*(p+1)));
has_dot = true;
+ } else if (*p == 'E' || *p == 'e') {
+ error |= has_E;
+ has_E = true;
} else
error = true;
}
diff --git a/test/cfg/std.c b/test/cfg/std.c
index 9a5377081..1416e8cdf 100644
--- a/test/cfg/std.c
+++ b/test/cfg/std.c
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
void bufferAccessOutOfBounds(void)
{
@@ -3134,6 +3135,78 @@ void invalidFunctionArg_strchr(char *cs, int c)
(void)strchr(cs, 256);
}
+void invalidFunctionArg_log10(float f, double d, const long double ld)
+{
+ // cppcheck-suppress invalidFunctionArg
+ // cppcheck-suppress wrongmathcall
+ (void)log10f(0.0f);
+ (void)log10f(1.4013e-45f); // note: calculated by nextafterf(0.0f, 1.0f);
+ (void)log10f(f);
+ (void)log10f(FLT_MAX);
+
+ // cppcheck-suppress invalidFunctionArg
+ // cppcheck-suppress wrongmathcall
+ (void)log10(0.0);
+ (void)log10(4.94066e-324); // note: calculated by nextafterf(0.0, 1.0);
+ (void)log10(d);
+ (void)log10(DBL_MAX);
+
+ // cppcheck-suppress invalidFunctionArg
+ // cppcheck-suppress wrongmathcall
+ (void)log10l(0.0L);
+ (void)log10l(4.94066e-324L); // note: calculated by nextafterf(0.0L, 1.0L);
+ (void)log10l(ld);
+ (void)log10l(LDBL_MAX);
+}
+
+void invalidFunctionArg_log(float f, double d, const long double ld)
+{
+ // cppcheck-suppress invalidFunctionArg
+ // cppcheck-suppress wrongmathcall
+ (void)logf(0.0f);
+ (void)logf(1.4013e-45f); // note: calculated by nextafterf(0.0f, 1.0f);
+ (void)logf(f);
+ (void)logf(FLT_MAX);
+
+ // cppcheck-suppress invalidFunctionArg
+ // cppcheck-suppress wrongmathcall
+ (void)log(0.0);
+ (void)log(4.94066e-324); // note: calculated by nextafterf(0.0, 1.0);
+ (void)log(d);
+ (void)log(DBL_MAX);
+
+ // cppcheck-suppress invalidFunctionArg
+ // cppcheck-suppress wrongmathcall
+ (void)logl(0.0L);
+ (void)logl(4.94066e-324L); // note: calculated by nextafterf(0.0L, 1.0L);
+ (void)logl(ld);
+ (void)logl(LDBL_MAX);
+}
+
+void invalidFunctionArg_log2(float f, double d, const long double ld)
+{
+ // cppcheck-suppress invalidFunctionArg
+ // cppcheck-suppress wrongmathcall
+ (void)log2f(0.0f);
+ (void)log2f(1.4013e-45f); // note: calculated by nextafterf(0.0f, 1.0f);
+ (void)log2f(f);
+ (void)log2f(FLT_MAX);
+
+ // cppcheck-suppress invalidFunctionArg
+ // cppcheck-suppress wrongmathcall
+ (void)log2(0.0);
+ (void)log2(4.94066e-324); // note: calculated by nextafterf(0.0, 1.0);
+ (void)log2(d);
+ (void)log2(DBL_MAX);
+
+ // cppcheck-suppress invalidFunctionArg
+ // cppcheck-suppress wrongmathcall
+ (void)log2l(0.0L);
+ (void)log2l(4.94066e-324L); // note: calculated by nextafterf(0.0L, 1.0L);
+ (void)log2l(ld);
+ (void)log2l(LDBL_MAX);
+}
+
void uninitvar_wcschr(void)
{
wchar_t *cs;