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
0 answers

How do I annotate a SocketIO namespace for IntelliJ code completion?

A perhaps pedantic question: I'm enjoying the type checking of IntelliJ and would like to know how to aid it in resolving more complex types. In my NodeJS project I pass a SocketIO namespace into the constructor of a controller class. I'd like…
Duncan
  • 858
  • 1
  • 11
  • 29
1
vote
0 answers

What is the difference between static code analysis and dynamic analysis?

I just wanted to know what the difference is between static program analysis and dynamic analysis. How are each of these two done?
user3011084
  • 133
  • 6
1
vote
0 answers

Types Flow in python using AST, visitor pattern

I need to extract types and dependencies flow for python code. E.g: for the following code - x = 1 + 2 y = x m = y.someFunc("123") I want to say that: x is a Number y is dependent in x (hence it is a Number too) m is dependent in y and in "123"…
1
vote
1 answer

Can I remove NULL and bounds checks if I use SAL?

How much can I rely on SAL? Do I need to do NSTATUS my_func(_In_ int *p) { if (NULL == p) { return STATUS_INVALID_PARAMETER; } *p = 1; return STATUS_SUCCESS; } or can I just do NTSTATUS my_func(_In_ int *p) { *p = 1; …
Thomas
  • 13
  • 2
1
vote
3 answers

How best for an old timer to manage type safety in Javascript

I've been writing C/C++/C# for decades, and have used JavaScript as needed for web projects, but want to expand that and do some more in-depth development with Canvas and JavaScript. My concern is how easily you can make mistakes like setinterval()…
Dave
  • 1,521
  • 17
  • 31
1
vote
1 answer

Wildcards in vera++

I feel really really dumb but how do I use wildcards with vera++? I would think I could do: vera++ --root "C:\Program Files (x86)\vera++\lib\vera++" -R L001 *.cpp But I get: error: cannot open source file *.cpp while executing "GetAllLines…
Daniel Dekkers
  • 269
  • 4
  • 11
1
vote
1 answer

Filtering code elements when analyzing source code

Currently I am making a survey about source code analysis and the thing that puzzles me greatly is what is it that project managers and developers would like to filter when analyzing source code (especially when applying OOP metrics - e.g. skpping…
1
vote
1 answer

why sparse report the sizeof(bool) warning?

I am very new to sparse and i am using it to clean the noise from the code. Recently, somewhere in code line: kzalloc(sizeof(bool) * nvhost_syncpt_nb_pts(sp), GFP_KERNEL); I encountered this sparse warning: warning: expression using sizeof bool…
Amit Sharma
  • 1,987
  • 2
  • 18
  • 29
1
vote
2 answers

Check binary references in a solution

I'm looking for a way to detect problems with assembly references in a large Visual Studio solution: Binary references to bad locations, like a path not in source control or in the output of another project Binary references to multiple versions of…
Marnix van Valen
  • 13,265
  • 4
  • 47
  • 74
1
vote
1 answer

Coverity - Explicit null dereferenced (FORWARD_NULL) in contentResolver.delete()

Deleting all the rows from ContentProvider using delete() statement gives the Coverity error. Explicit null dereferenced (FORWARD_NULL) Passing null pointer selection to delete, which dereferences it. String selection = null; String[] selectionArgs…
Vijay C
  • 4,739
  • 4
  • 41
  • 46
1
vote
1 answer

How to remove Non-atomic use of check/put and make the code thread safe?

I have a code from which I am trying to get the instance of my class as I have written a wrapper around java.util.logging.Logger. Below is the snippet of code in my ClientLogger class - private static final Map, ClientLogger>…
john
  • 11,311
  • 40
  • 131
  • 251
1
vote
1 answer

Java: Displaying all Strings used in method invocations

I am trying to display all the strings used in a method invocation using SOOT program analysis framework. I am able to check for StringConstant but how do I get values for RefType ? Here is the sample code : for (Value va :…
Alan Kash
  • 11
  • 1
1
vote
0 answers

Does AppCode provide tools for displaying class dependencies as IntelliJ does?

IntelliJ has a Dependency Analysis tool. This tool generates a "Dependencies Structure Matrix" that "reflects the real dependencies between classes in a project". This is how it looks like in IntelliJ: I would love to see the class dependencies of…
Lars Blumberg
  • 19,326
  • 11
  • 90
  • 127
1
vote
2 answers

PMD gets in the way of CheckStyle

I'm starting to use Static Code Analysis tools like Checkstyle, PMD and FindBugs. PMD allows to mark code as reviewed, by adding a comment to the end of the line: System.out.println("Test"); // NOPMD by edward on 9/23/14 10:22 AM I really don't…
Edward
  • 4,453
  • 8
  • 44
  • 82
1
vote
2 answers

Getting sizes of class member variables (without running code)

Is there a way to get the sizes of all member variables of a particular class without actually running the code? (i.e no sizeof(), offset_of() operations) Do objdump or otool have some options to extract this information from the intermediate object…
cradical
  • 117
  • 7