fuzzyc2cpg
fuzzyc2cpg copied to clipboard
Escape characters in function names
Description
The CPG contains function names with escape sequences, eg. CHAT_PROTOCOL(server)->\\n\\t\\t\\tquery_create
. It seems to be a parsing error of:
query = CHAT_PROTOCOL(server)->
query_create(server->tag, nick, TRUE);
See: https://github.com/irssi/irssi/blob/master/src/fe-common/core/fe-queries.c#L53-L54
Reproduction steps
- CPG creation:
$ git clone https://github.com/irssi/irssi
$ ./fuzzyc2cpg.sh irssi/src/ --out irssi.bin.zip
- Load the CPG and search the function
ocular> loadCpg("irssi.bin.zip")
ocular> cpg.method.fullName("CHAT.*query_create.*").fullName.p
res5: List[String] = List("CHAT_PROTOCOL(server)->\\n\\t\\t\\tquery_create")
"The first one an parsing error"?
You are right it sounds weird. I have updated the issue.
This seems to crop up after running the Cpg2Scpg enhancements.
Running irssi through ./joern-parse
with --noenhance
and running the above query results in:
joern> cpg.method.fullName("CHAT.*query_create.*").fullName.p
res1: List[String] = List()
Running with the enhancements enabled, we get:
joern> cpg.method.fullName("CHAT.*query_create.*").fullName.p
res2: List[String] = List("CHAT_PROTOCOL(server)->\\n\\t\\t\\tquery_create")
Ok, I believe this line is causing the issue: https://github.com/ShiftLeftSecurity/fuzzyc2cpg/blob/master/src/main/scala/io/shiftleft/fuzzyc2cpg/astnew/AstToCpgConverter.scala#L347
Is this something we'd want to remove? Everything else is also escaped
CC @fabsx00
Can you try and see what happens? I think it may be removable.