Comments (6)
Current version of joern (v1.1.440) is handling x
as a local.
Based on your initial code snippet, you should be able to query for x
with:
joern> cpg.local.l
res4: List[Local] = List(
Local(
id -> 3074457345618258674L,
closureBindingId -> None,
code -> "int x",
columnNumber -> None,
dynamicTypeHintFullName -> ArraySeq(),
lineNumber -> Some(value = 1),
name -> "x",
order -> 1,
typeFullName -> "int"
)
)
Closing..
from joern.
Yes, this should be handled. What do you mean by "shows no references to" exactly?
from joern.
@fabsx00 "shows no references to" means that "x" "int x" etc. does not exist in the cpg.zip database.
Additionally, I have found that while the database created from
typedef int size_t;
void *malloc(size_t x);
contains no information (or any reference to) malloc, the following does
typedef int size_t;
void *malloc(size_t x) {
}
from joern.
Therefore, it appears that any declarations are skipped while definitions are added to the database.
from joern.
Hi @sciencemanx
In regards to the first item, it seems that we only processes top-level identifier declarations if they are typedef
s. See https://github.com/ShiftLeftSecurity/fuzzyc2cpg/blob/master/src/main/scala/io/shiftleft/fuzzyc2cpg/astnew/AstToCpgConverter.scala#L593-L594
At first glance, it seems we will need to change the existing code to create a LOCAL
or IDENTIFIER
node at the top level of the CPG. Alternatively we can start construction of the CPG with by beginning with a "global scope" pushed on the scope stack (currently the scope stack is initialized to be empty), and then add any corresponding nodes as before.
As for the second item (erased function declarations), with the code you have provided I am unable to reproduce the issue you are having:
Code:
typedef int size_t;
void *malloc(size_t x);
Query:
joern> cpg.method.l
res12: List[Method] = List(
Method(
id -> 8L,
name -> "malloc",
fullName -> "malloc",
isExternal -> false,
signature -> "void*(size_t)",
astParentType -> null,
astParentFullName -> null,
lineNumber -> Some(2),
columnNumber -> Some(0),
lineNumberEnd -> Some(2),
columnNumberEnd -> Some(22),
order -> null,
hasMapping -> None,
depthFirstOrder -> None,
binarySignature -> None
)
)
from joern.
See ShiftLeftSecurity/fuzzyc2cpg#156
from joern.
Related Issues (20)
- [c2cpg] Use eclipse CDT keywords table HOT 4
- Java - function of anonymous class is not in the list of all nodes
- [GO] - Cache struct type members type information before AST Creation and make changes in fieldAccess call node to assign this typeFullName from the cache
- [GO] - Error while creating receiver node HOT 1
- handle range loop HOT 1
- [GO] - IndexAccess call node handling for Map
- [GO] - WARN AstCreator: Unhandled class class io.joern.gosrc2cpg.parser.ParserAst$ArrayType$ under astForCallExpression!
- [GO] - Exception in thread "Writer" java.lang.RuntimeException: Edge with type='CONDITION' with direction='IN' not supported by nodeType='LOCAL' HOT 1
- [Bug] source code line number bug in dot files generated by joern
- [Bug] switch...case statement control dependencies bug in pdg
- [GO]- proper Switch case handling to add variable declaration and assignment call nodes under the body block AST node of Switch case.
- [GO] - Download the dependencies and cache method and Type information to be used in lookup while AST is being created
- MethodFullName of chained method
- MethodFullName getting "ANY"
- [Ruby] - Loss in flows after joern version 2.0.92 HOT 5
- [Bug] Inconsistent results while using reachableByFlows.
- [GO] Handle global variable and constant HOT 1
- [Go] Dataflow through sql query
- [GO] Dataflow issue in SQL query HOT 1
- [Bug] Index out of bound for JavascriptTypeRecovery failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joern.