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

Sample Programs for Design Pattern Recover Tool

I'm developing a Design Pattern Recovery tool for my final year project. It is a java based system which can be used in identifying, implemented design patterns in a particular java program. When you input the java program (Source code) to the…
1
vote
1 answer

Make nulls opt-in only

Let's pretend that I hated null. Let's pretend that making it opt-out, like @Nullable, doesn't go far enough for me. Let's say I wanted it to be opt in; if an object is not explicitly annotated with @Nullable, then nulls are not…
Verdagon
  • 2,456
  • 3
  • 22
  • 36
1
vote
1 answer

By analyzing the bytecode, how can I detect explicit throw statement invocations from within a catch block?

I want to detect throw statements that occur from within a catch block. For instance: try { def(); } catch (IOException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } First, I was using Eclipse-JDT to detect…
EijiAdachi
  • 441
  • 1
  • 3
  • 15
1
vote
0 answers

Integrate PCLint to VC++ for possible suggestion and solution

The trigger for this idea is from purify. When we use purify, it has a extensive online help (online here means option in command prompt) which will help developer to understand the error and possible fixes. Similar to this, I would like to have…
1
vote
1 answer

Why does NDepend show CQL errors when run on the command line but not from the GUI?

I've got this bit of CQL: // A stateless class or structure might be turned into a static type warnif count > 0 (from t in Application.Types where t.SizeOfInst ==0 && // For accuracy, this constraint doesn't take // account of…
Steve Dunn
  • 21,044
  • 11
  • 62
  • 87
1
vote
0 answers

Code Analysis does not work in VS 2010 - Code Analysis Complete -- 0 error(s), 0 warning(s)

I'm trying to use Code Analysis in VS2010, but it's not working. My sample appl: #include "stdafx.h" #include int getj() { return 10; } int a(int *n) { int b = *n; int c = 1/b; return c; } int _tmain(int…
1
vote
1 answer

Finding variable/method references from Abstract Syntax Tree

I want to find references to a given variable or callers of a given method, just like the "open call hierarchy" and "(find) references" features in Eclipse (when you right-click a variable or a method.) Now I've obtained the Abstract Syntax Tree of…
Ida
  • 2,919
  • 3
  • 32
  • 40
1
vote
1 answer

Comparison method violates its general contract! Static analysis possible?

As many people before, I hit IllegalArgumentException: Comparison method violates its general contract! I need to check the legacy code for all possible occurences of this. The best way would be a static analysis tool that will go through all the…
MartinTeeVarga
  • 10,478
  • 12
  • 61
  • 98
1
vote
2 answers

Clang static analyzer output in xml format

Is it possible to get output in XML format from Clang scan-build analyzer? Currently following command generates output in html format to view in webbrowser. scan-build xcodebuild -configuration Debug -sdk iphonesimulator CppCheck on windows…
1
vote
2 answers

"CA2000 Dispose objects before losing scope " for unknown reason

I have checked out the MSDN documentation, and adopted the recommended pattern in this code fragment: BitmapSymbols temp = null; try { using (var source = bitmaps.Symbols) { temp = new BitmapSymbols(source, sizeSymbols); } …
Pieter Geerkens
  • 11,775
  • 2
  • 32
  • 52
1
vote
0 answers

Handling dynamic typing in pylint?

We have pylint hooked up with our Django build, and one of the high priority errors we're getting "Instance of 'unicode' has no 'state' member" I've set the generated-members variable on variables that are truly generated (i.e. X_id and Y_set) so…
DivineWolfwood
  • 1,752
  • 12
  • 20
1
vote
2 answers

SONAR - C code analysis

I'm trying to check the .cpp code with sonar, but I have problems with it. Sonar version: 3.5.1 // MySQL 5.0.67 I have this plugin installed on my Sonar. Sonar C++ Community Plugin [cxx] Version: 0.2 C++ Plugin for Sonar (Community…
AbelBs24
  • 11
  • 1
  • 2
1
vote
1 answer

How can we use VS2012 Static Analysis Rules with FxCop 10 Standalone

We're struggling to get some rules that work fine in the VS2012 code analysis tool, to appear in FxCop 10. Specifically we're trying to get CA2100 - "Review sql queries for security vulnerabilities" We've tried adding the DLLs from VS2012 (11) but…
danswain
  • 4,171
  • 5
  • 37
  • 43
1
vote
0 answers

java monitor objects: threads BLOCK on some

While desperately trying out anything to unravel my load test glitches I came across TDA, a thread dump analysis tool for Java. Somehow I don't feel I am following its output. For instance, shouldn't there have been one thread in state RUNNABLE in…
kellogs
  • 2,837
  • 3
  • 38
  • 51
1
vote
1 answer

How can I convince XCode's Analyzer that this isn't a leak?

The static analyzer is informing me that the following code has a potential leak. I don't understand how there's any room for a leak. Further, I don't understand how the analyzer can be so helpful across the entire project yet miss something this…
bmauter
  • 2,953
  • 4
  • 21
  • 24
1 2 3
99
100