Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Escape characters in function names #18

Open
itsacoderepo opened this issue Jan 23, 2019 · 5 comments
Open

Escape characters in function names #18

itsacoderepo opened this issue Jan 23, 2019 · 5 comments
Assignees

Comments

@itsacoderepo
Copy link
Contributor

itsacoderepo commented Jan 23, 2019

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

  1. CPG creation:
$ git clone https://github.com/irssi/irssi
$ ./fuzzyc2cpg.sh irssi/src/ --out irssi.bin.zip 
  1. 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")
@fabsx00
Copy link
Contributor

fabsx00 commented May 7, 2019

"The first one an parsing error"?

@itsacoderepo
Copy link
Contributor Author

You are right it sounds weird. I have updated the issue.

@fabsx00 fabsx00 changed the title Function name parsing Escape characters in function names May 10, 2019
@GlassAndOneHalf
Copy link
Contributor

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")

@GlassAndOneHalf
Copy link
Contributor

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

@fabsx00
Copy link
Contributor

fabsx00 commented Nov 7, 2019

Can you try and see what happens? I think it may be removable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants