From 10de931b92dc566c2c9152a37027ee6c12be91e9 Mon Sep 17 00:00:00 2001 From: Jonas Jensen Date: Tue, 17 Nov 2020 09:48:32 +0100 Subject: [PATCH] C++: Decrease largeVariable cut-off to 100k This 10x lower cut-off has on at least one snapshot made it possible to compute AST data flow where it was infeasible before. Also fix an integer overflow that happened in practice on at least one snapshot and prevented the cut-off from being applied. --- cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll b/cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll index 33a74c967189..f3aa94a79920 100644 --- a/cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll +++ b/cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll @@ -620,7 +620,8 @@ module FlowVar_internal { private predicate largeVariable(Variable v, int liveBlocks, int defs) { liveBlocks = strictcount(SubBasicBlock sbb | variableLiveInSBB(sbb, v)) and defs = strictcount(SubBasicBlock sbb | exists(TBlockVar(sbb, v))) and - liveBlocks * defs > 1000000 + // Convert to float to avoid int overflow (32-bit two's complement) + liveBlocks.(float) * defs.(float) > 100000.0 } /**