Questions tagged [code-analysis]

Code Analysis is the process of analyzing the code of the application to discover, review, validate or verify certain properties of the application. This is useful during the process of development and for testing the application before it is put in production mode, especially for checking the security related aspects.

Code Analysis is the process of analyzing the code of the application to discover, review, validate or verify certain properties of the application. This is useful during the process of development and for testing the application before it is put in production mode, especially for checking the security related aspects. Code analysis can be classified from several perspectives, including:

1. What can be analyzed: source code or binary code (byte code) of the application can be analyzed. Both of these categories have their pros and cons.

2. How or When should code be analyzed: Code can be analyzed statically (without executing it) or dynamically (while the application is executed). Static analysis, being conservative, is prone to false positive, but it is exhaustive. On the other hand, dynamic analysis, being very accurate, may miss certain behaviors which are not manifested in any of the execution monitored (because dynamic analysis only analyzes code that is executed - i.e. when certain conditions are met)

3. Purpose of the analysis: Flaws can be found, like NULL pointer dereferencing or passing an ASCII string instead of a Unicode string. Furthermore, aspects of the code can be found, like building various graphs of dependencies or deducing the conditions under which recursion will occur.

1882 questions
0
votes
1 answer

Soot - Map from java class to jimple

With the following code I can get the jimple representation of a java .class file: soot.Main.main(args); SootClass mainClass = Scene.v().getMainClass(); String methodSignature = "void main(java.lang.String[])"; …
0
votes
0 answers

CA0052 Could not identify plateform And CA0055 not targets were selected when Enable code analysis VS 2019

I'm using vs 2019 with .Net 5 and tried to run code analysis with MsBuild command, When I was using FxCorp its worked perfectly but fxcorp is deprecated I was getting below error Warning CA0507 Post-build Code Analysis (FxCopCmd.exe) has been…
0
votes
1 answer

Soot - Get JimpleBody from a CFG

I'd like to get UnitGraph from a Java Class. I load it by ClassFile and get the method_info of main(). Then I create a CFG and try to convert it into a UnitGraph. My method is to get JimpleBody of the CFG and then create a UnitGraph. However, I…
0
votes
2 answers

CA2000: Object is not disposed along all exception paths

I am having trouble trying to figure out why I'm getting this warning in following code. CA2000 : Microsoft.Reliability : In method 'Encryption64.Decrypt(String, String)', object 'des' is not disposed along all exception paths. Call…
Hiral Desai
  • 1,062
  • 1
  • 9
  • 24
0
votes
1 answer

Why is code analysis warning "Using logical && when bitwise & was probably intended" being raised?

Code: BOOL CCreateReportDlg::CanSwapBrothers() { BOOL b1in2 = FALSE, b2in1 = FALSE; CStringArray aryStrNames; // Must have valid data if (!IsSwapBrotherInit()) return FALSE; // Get cell pointers auto…
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
0
votes
1 answer

AWS CodeGuru profiler under different account

We are trying to build a centralised CodeGuru profiler dashboard as described by the documentation at https://aws.amazon.com/blogs/devops/building-a-centralized-codeguru-profiler-dashboard-multi-account/. So in effect, we have our CodeGuru profiling…
emecheon
  • 307
  • 3
  • 10
0
votes
1 answer

Howto parse multiple files (whole packages) with pylint

I am working with python 2.7 and installed pylint 0.24, as an IDE i use Eclipse (with pydev) and the OS is windows 7 64 bit. Pylint works so far, but in eclipse i only get the pylint report when i save a python file. So my question is, is it…
Gobliins
  • 3,848
  • 16
  • 67
  • 122
0
votes
2 answers

Does a multi programming language parsing / function extraction toolkit exist?

I'm looking for a way to extract function names and their definitions from multiple different programming languages. I would like to avoid writing extractors by hand as I want to support about 15 programming languages. Is there a library / program…
JanLikar
  • 1,296
  • 9
  • 22
0
votes
1 answer

Flutter: code analysis and layout explorer in code at build time

I'm new to flutter, so I hope my question will not be too much out of scope: I would like to extract meta informations about the app at build time. The idea is to have JSON tree of the app widgets and send it to an external database via API call for…
TOPKAT
  • 6,667
  • 2
  • 44
  • 72
0
votes
0 answers

Is there a way around, Visual Studio's Code Analysis UNTRUE Warnings?

i am getting this "ill defined for loop" for my c++ code below size_t total = someValue; if (total > 0) for (size_t i = total - 1; i >= 0; i--) { //some loopy work if (i == 0) break; } Warning C6295 …
Ibrahim Ozdemir
  • 613
  • 1
  • 5
  • 18
0
votes
1 answer

Get all Invocation expression names in a MethodDeclaration body

I am trying to find all instances of Update() method declarations and then checking its body's invocation expression identifier tokens to see if it's called GetComponent. How would I go about doing this? I can find the method declaration of Update…
Jurg Puila
  • 21
  • 4
0
votes
0 answers

How to suppress Inspection of JavaScript code block in IntelliJ IDEA?

I've run Inspect Code on a JavaScript file in IntelliJ IDEA. I'm presented with options to Suppress for statement or Suppress for file, but I need to suppress for a block of code. I tried wrapping /* eslint-disable */ and /* eslint-enable */ around…
0
votes
0 answers

Finding all usages of a value (Typescript)

Consider the following code: // constants.ts export const CONSTANTS = { CONFIG: { PREFIX: 'dot-' } }; // component.ts -- Illustrating all the different ways the constant value `dot-` is used. import {CONSTANTS} from './constants'; class…
Sterex
  • 1,026
  • 1
  • 13
  • 29
0
votes
1 answer

Warnings C26415 / C26418 when passing a COM interface smart pointer to a function

Here is the definition of a function: void CMSATools::SetPublisherDatesNotAvailable(MSAToolsLibrary::IAvailabilityPtr pAvailability, std::vector& rVectorDates, …
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164
0
votes
0 answers

Code analysis warning C26481 and std::map with bool array

I have this definition for an std::map: using AssignedStudyPoints = map; I have an instance of this as a member variable in one of my classes: AssignedStudyPoints m_mapStudentAssignedStudyPoints; And the…
Andrew Truckle
  • 17,769
  • 16
  • 66
  • 164