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
1 answer

Xamarin Static Analysis with Unity

My company is working on a game in Unity and I'm starting to integrate static code analysis into our project. We use Xamarin Studio as our IDE and it has source analysis out of the box with a lot of rules we can use. The question I have is how can I…
tdeeb
  • 11
  • 3
1
vote
1 answer

Automatic Static Source code analysis at the time of source commit/check-in

Is there a mechanism to identify incoming source code signatures and in-line source code documentations via GIT or SVN. For Example: If someone commits a Java code to a source control this interceptor should validate all the method names and check…
Dickens A S
  • 3,824
  • 2
  • 22
  • 45
1
vote
1 answer

Getting warning - Dereferencing before possibly being null in C code

I'm getting a warning while doing a Static Analysis (SA) on my code. I have simplified it below (with the first warning)- typedef struct testStruct_ { int *ptr; } testStruct; testStruct a; testStruct *a_ptr; a_ptr = &a; a_ptr->ptr = NULL; #WARNING:…
sbhatla
  • 1,040
  • 2
  • 22
  • 34
1
vote
3 answers

Binary Analysis Research Tools

Can some one provide me with a list of leading binary research tools for Windows OS and windows applications? I found BinScope from microsoft itself but was wondering if there are any other better tools around? Thanks, Omer
okm
  • 283
  • 6
  • 18
1
vote
1 answer

Static code analysis tools for finding defects in unit tests?

I'm looking for .NET static code analysis tools that can detect things like unit tests without an assert, too many asserts in one test, and other anomalies.
MatthewMartin
  • 32,326
  • 33
  • 105
  • 164
1
vote
1 answer

Finding Loop Iterator in static Analysis

How can we find loop iterator in static analysis? What are different condition for a variable to be iterator? In a super simplified for loop like for(i = 0; i < n; i++); we can assume that, lhs of initialization expression is iterator. But how can…
niyasc
  • 4,440
  • 1
  • 23
  • 50
1
vote
0 answers

Analysing the method call path of a PHP application

I am trying to find a static analysis tool that is able to output every object + method that my PHP application runs through. I am currently using xdebug, which does its work but is a runtime analysis tool. And ignores a lot of paths, because they…
Stefan Schouten
  • 249
  • 4
  • 14
1
vote
2 answers

Python: Displaying an object's implementation source

I've been tasked with something a bit unusual and unexpectedly puzzling - Display the source code of a particular class's implementation of a method. In [1]: class Demonstration: ...: def cost(): ...: return 42 ...: In…
John
  • 173
  • 2
  • 9
1
vote
2 answers

ASP.Net MVC Keeping parameter names and action argument names in sync

I've noticed a pattern that can make refactoring MVC2 apps difficult. When you change the name of an argument for an action you must update the values everywhere that action is used. For example, public ActionResult List(string p) in the view <%=…
Joe
  • 1,043
  • 2
  • 12
  • 21
1
vote
1 answer

Why doesn't the Ideone.com C compiler catch mismatched pointer types?

Why am I able to pass pointers of the wrong type into C functions, without getting either a compiler error or a warning? //given 2 distinct types struct Foo{ int a,b,c; }; struct Bar{ float x,y,z; }; //and a function that takes each type by…
Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271
1
vote
2 answers

Pointer issues in Coccinelle

I want to change my code using a Coccinelle script: // Before modification #include #include int main() { int i; int *p; *p=i; return 0; } The expected result is: // After modification #include…
fedi
  • 368
  • 3
  • 7
  • 18
1
vote
0 answers

Calculate NPath complexity for try-catch-finally

I've read article "NPATH: A MEASURE OF EXECUTION PATH COMPLEXITY AND ITS APPLICATIONS" Nejmeh, Communications of the ACM Feb 1988 pp 188-200, it says nothing about NPath complexity for try-catch-finally statement. The formula I deduced is NP(T-C-F)…
atta trol
  • 11
  • 1
1
vote
1 answer

Web API resource usages in frontend

I've run into this problem a few times. I change the result or parameters of a resource and I search for where it's used and change that too. But every so often I missed some obscure part of the app. What is a good technique to find all places a API…
1
vote
5 answers

How to identify if an object returned was created during the execution of a method - Java

Original Question: Given a method I would like to determine if an object returned is created within the execution of that method. What sort of static analysis can or should I use? Reworked Questions: Given a method I would like to determine if an…
Brittin
  • 13
  • 3
1
vote
1 answer

Static analyzer says I have the potential leak of an object

This is an object I made to do some flash cards. The first method (I left out the main part) generates a NSMutabaleArray of Card objects with the passed in operator and works fine. The second method, "drawFromDeck" gets called on a Deck object…