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

C# static array bound check

Is there a tool for C# which can statically (without executing the code) detect out of bound array access, i.e., array access that will throw IndexOutOfRangeException. Thank you. EDIT: Yes, I am aware that it is a theoretically impossible to do it…
1
vote
2 answers

How to find where Class1 is referenced in Class2 using reflection?

I am trying to run some primitive static code analysis and, for starters, I want to find all the references to Class1 in Class2, similar to how an IDE find usage for a class (e.g. methods and line numbers). Just browsing throw the reflection…
amphibient
  • 29,770
  • 54
  • 146
  • 240
1
vote
1 answer

Exclude not needed reports in checkstyle reports

I am first time using maven checkstyle plugin. I added checkstyle plugin in parent pom and i specified some list of rules in checkstyle.xml. I running "mvn clean site" to generate reports. Every thing working fine, but it generating lot of not…
Sun
  • 3,444
  • 7
  • 53
  • 83
1
vote
1 answer

C code injection

What I am trying to do seems simple comparing to complicated code static analysis work finding all the assign code, and insert a new code snippet based on the value used in the assign code to update certain memory finding all the basic control…
lllllllllllll
  • 8,519
  • 9
  • 45
  • 80
1
vote
1 answer

Java static analyzer custom templating/specification

We have a Java project that uses TeamCity to do static analysis of our Java classes each night to find low hanging bugs in our code. We would like to tell TeamCity to look for a new type of bug that developers might introduce that has to do with…
Amir Afghani
  • 37,814
  • 16
  • 84
  • 124
1
vote
0 answers

Coverity Prevent 5 for .NET development?

Do you use Coverity Prevent or Coverity Prevent 5 with .NET development? If yes, what are your feelings about it?
Bill Campbell
  • 2,413
  • 6
  • 27
  • 32
1
vote
1 answer

How to detect multiple statments per line?

We have a coding style which says, "Use no more than one statement per line" and "Excluding opening braces, the body of iteration-statements and of selection-statements are to begin on different lines than the statement's condition and, in the case…
xuinkrbin.
  • 975
  • 2
  • 7
  • 17
1
vote
1 answer

Static analysis tools for closed-source iPhone apps

I am searching for a tool or a combination of tools that can be used for static analysis of closed-source iPhone apps. I am interested in building a control flow graph of these apps. So I am thinking of doing the following: Decrypt the app, if…
1
vote
2 answers

Static code analysis Java

I want to know how a particular variable in Java class is used. Are there any static code analysis tools which help me trace out the variable. For example: Class A { int trackMe; function usedHere(trackMe); B bobject = new B(trackMe);…
Adi GuN
  • 1,244
  • 3
  • 16
  • 38
1
vote
2 answers

C++/clang analyzer memory leaks?

I'm trying to get clang++ to tell me there is a memory leak. I tried scan-build but it reported nothing. How do I get llvm/clang to warn me of this problem? #include int main() { int *a = new int; *a = 8; …
user2814152
  • 197
  • 9
1
vote
0 answers

clang analyzer memory leaks

Why doesn't clang/clang-analyzer catch that I forgot to free a and have a memory leak? It's obvious. I looked at the man pages and i'm not sure what flags are required. $ scan-build clang++ -std=c++11 a.cpp scan-build: Using '/usr/bin/clang' for…
user2814152
  • 197
  • 9
1
vote
0 answers

Find specific construct in C++ code

I'm looking for an idea how to find all the while loops in my huge code that declare a variable within the loop header. The problem is that while ( item a = list.next() ) is not working correctly in xlC 12.1 : the constructor of 'item' is called…
ModdyFire
  • 706
  • 3
  • 9
  • 19
1
vote
4 answers

What are the static tool analysis options (apart from CAST) via plug-ins for Java code with framework?

Need to know about static tool analysis options via Eclipse plug-ins for Java code with framework especially for Struts, Spring and Hibernate. The purpose is primarily analysis (and not Quality metrics) of references (similar to References option in…
HT.
  • 227
  • 3
  • 8
1
vote
3 answers

javascript code analysis, abstract syntax tree & stuff

I need to make a script that will analyse javascript files for specific errors in the code. One of the first envisioned ways of doing so is by building an abstract syntax tree of the files. Is this doable with nodejs or any other tool? (preferably…
aspyct
  • 3,625
  • 7
  • 36
  • 61
1
vote
3 answers

How do I know the type of the exception being thrown at the bytecode level?

An explicit call to the throw statement is represented at the bytecode level with an athrow instruction. For instance, the code snippet below: private static SQLException thrower() throws SQLException { throw new SQLException(); } Is translated…
EijiAdachi
  • 441
  • 1
  • 3
  • 15
1 2 3
99
100