Questions tagged [static-analysis]

"Static Analysis" refers to the software tools (or their use) to analyze application code for arbitrary properties, such as errors (uninitialized variables, possible SQL injection-attack, is this code-dead, can an argument be null,...) or structure (what is the call graph for this code? is there duplicate code? what information is passed between components?).

Static analysis refers to the software tools (or their use) to analyze application code for arbitrary properties, such as errors (uninitialized variables, possible SQL injection-attack, is this code-dead, is there duplicate code, can an argument be null), or structure (what is the call graph for this code? what information is passed between components?).

The variety of questions that one might ask about application properties is endless. Usually, one needs a tool customized to answer each individual question, for each individual language. And each such tool typically requires a lot of engineering, as most of them have to contain a significant part of a compiler front end just to read the source code and understand the meaning of the source code entities. Consequently, such tools are rare for the specific question you want to ask; where they exist, there are as many static analysis software tools are there are questions, although often a set of questions are rolled up into a single tool.

(In contrast, dynamic analysis refers to collecting data about interesting properties as an application program actually executes, e.g., "did this sum overflow at runtime?". In principle, a static analysis tool can provide exactly the information that dynamic analysis can, just by simulating the execution of the program, but its a lot of work to build such a simulator when there's already a computer lying around that is willing to do it for no extra effort.)

2152 questions
1
vote
3 answers

What is Compiler Generated constructor for abstract class no data members

I'm running a static analysis tool and getting an error because an abstract class, with no data members, has no constructors. Given an abstract class with no data members: class My_Interface { public: virtual void interface_function(void) =…
1
vote
3 answers

splint failing on code that includes complex.h

I'm trying to run splint on a C source that includes complex.h from the standard C library to support complex arithmetic. Unfortunately, splint fails with the following error. Splint 3.1.2 --- 03 May 2009 /usr/include/bits/cmathcalls.h:54:31: …
Shawn Chin
  • 84,080
  • 19
  • 162
  • 191
1
vote
1 answer

Defining findbugs detector using the existing plugins

I'm trying to figure out how could I implement a detector using findbugs. Also I don't want to create a plugin since findbugs already has this functionality. I need my detector to check if all the calls to ClassName.getConnection() are matched by…
Lucian
  • 794
  • 1
  • 9
  • 21
1
vote
1 answer

How do you include subroutine calls in a control flow graph?

I get the idea of a control flow graph; it involves nodes that are basic blocks (sequences of operations that always occur), connected by edges that represent jumps. But how do you represent a subroutine call? If I have two functions like this: int…
Jason S
  • 184,598
  • 164
  • 608
  • 970
1
vote
1 answer

Facebook Flow Function Union Type

I'm playing around with Facebook Flow and wonder, why does the following function not type check? It obviously uses a union type denoted by '|'. declare var f: ((x: any) => number) | ((x: any) => string); function f(x) { if(true) { …
1
vote
1 answer

Why won't this Code Contracts relationship prove?

I have a method that starts like this: public static UnboundTag ResolveTag(Type bindingType, string name, string address) { Contract.Requires(bindingType != null); var tags =…
Dan Bryant
  • 27,329
  • 4
  • 56
  • 102
1
vote
1 answer

How to track differences between the C source and Frama-C's preprocessed code?

In frama-C when I load my source file it does pre processing and does automatic error correction like "automatic typecast " as shown below (int is typecasted to float). Now how can I see all the changes made after preprocessing. Is there any method…
1
vote
3 answers

llvm : detect if/else conditions in function pass

I'm trying to write an LLVM analysis pass (function pass) which detects loop and if/else conditions to indentify possibles function call sequences and impossibles ones. To detect loops i used LoopInfo from LoopInfoWrapperPass, someone know if there…
islandia
  • 91
  • 1
  • 6
1
vote
1 answer

i18n language files. How to manage missing and unused keys

I have a Rails/Angular webapp. We use two different methods to translate our app: Ruby Globalize i18n with the corresponding yml language files, and angular-translate with the corresponding json language files. Managing language files can be a pain.…
1
vote
1 answer

Per-project options in Visual Lint?

I've used Visual Lint (as a frontend for PC-lint) in the past and somehow configured it to use a different options.lnt file for different projects. My recollection, which might be incorrect, is that it was configured to automatically pick up…
Bob Vesterman
  • 1,127
  • 1
  • 11
  • 31
1
vote
1 answer

Access whitespace or other formatting tokens in the source token stream while traversing the AST generated by Eclipse JDT

I am using ASTs to perform certain lint styled checking in addition to some static analysis and would like to understand how I can access whitespace and other such formatting tokens adjacent to AST nodes. I am currently using Eclipse JDT to generate…
np20
  • 1,935
  • 3
  • 16
  • 24
1
vote
1 answer

Taintflow analysis in dotnet

I want to do taint flow analysis in dotnet bytecode. I want to find all the tainted sources in the given dotnet bytecode and then all the program points affected by these tainted sources in it. I want to do static analysis of dotnet bytecode but I…
ashishk
  • 299
  • 1
  • 3
  • 17
1
vote
1 answer

How to validate constructor arguments without ca1804

Suppose I want to validate some arguments for a constructor of an object to be used later. Also, suppose the criteria for validation of these arguments is elaborate. For example, I want to check that some items I need to create an X509Certificate2…
Eric
  • 4,201
  • 5
  • 27
  • 36
1
vote
3 answers

Does DGML support different shapes?

I've started to play with DGML, and I see in the schema that the Node element supports a Shape attribute. I've tried things like
Scott Weinstein
  • 18,890
  • 14
  • 78
  • 115
1
vote
2 answers

Static analysis tool customization for any language

We are using a Tool in our project. This tool has its own language which is similar to Java. I am looking for a static analysis tool which can be applied to the new language. Are there any static analysis tools which can be customized to any…
Sam
  • 11
  • 1