Another fix for 10800: Hang / memory exhaustion on numerical code (#3851)
* Another fix for 10800: Hang / memory exhaustion on numerical code * Format
This commit is contained in:
parent
72d0f3e444
commit
1ac16413ea
|
@ -6874,6 +6874,12 @@ static bool needsInitialization(const Variable* var, bool cpp)
|
||||||
static void addToErrorPath(ValueFlow::Value& value, const ValueFlow::Value& from)
|
static void addToErrorPath(ValueFlow::Value& value, const ValueFlow::Value& from)
|
||||||
{
|
{
|
||||||
std::unordered_set<const Token*> locations;
|
std::unordered_set<const Token*> locations;
|
||||||
|
std::transform(value.errorPath.begin(),
|
||||||
|
value.errorPath.end(),
|
||||||
|
std::inserter(locations, locations.begin()),
|
||||||
|
[](const ErrorPathItem& e) {
|
||||||
|
return e.first;
|
||||||
|
});
|
||||||
if (from.condition && !value.condition)
|
if (from.condition && !value.condition)
|
||||||
value.condition = from.condition;
|
value.condition = from.condition;
|
||||||
std::copy_if(from.errorPath.begin(),
|
std::copy_if(from.errorPath.begin(),
|
||||||
|
|
|
@ -6318,6 +6318,23 @@ private:
|
||||||
" d(&f->a, c);\n"
|
" d(&f->a, c);\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
valueOfTok(code, "f");
|
valueOfTok(code, "f");
|
||||||
|
|
||||||
|
code = "struct bo {\n"
|
||||||
|
" int b, c, a, d;\n"
|
||||||
|
" char e, g, h, i, aa, j, k, l, m, n, o, p, q, r, t, u, v, w, x, y;\n"
|
||||||
|
" long z, ab, ac, ad, f, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar,\n"
|
||||||
|
" as;\n"
|
||||||
|
" short at, au, av, aw, ax, ay, az, ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk,\n"
|
||||||
|
" bl, bm;\n"
|
||||||
|
"};\n"
|
||||||
|
"char bn;\n"
|
||||||
|
"void bp() {\n"
|
||||||
|
" bo s;\n"
|
||||||
|
" if (bn)\n"
|
||||||
|
" return;\n"
|
||||||
|
" s;\n"
|
||||||
|
"}\n";
|
||||||
|
valueOfTok(code, "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowHang() {
|
void valueFlowHang() {
|
||||||
|
|
Loading…
Reference in New Issue