Skip to content

[pull] master from joernio:master #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
MIPS: NPE fix for sorting (joernio#813)
* NPE fix for sorting

Seems that i only have moved the NPE before

* Name ..

* try catch
  • Loading branch information
itsacoderepo authored Dec 11, 2021
commit dc9cb3b65ad8fd56a701c18252a93592b7ed23e4
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ class Ghidra2Cpg() {
new ReturnEdgesPass(cpg).createAndApply()
}
}

new TypesPass(cpg).createAndApply()
new JumpPass(cpg, keyPoolIterator.next()).createAndApply()
new LiteralPass(cpg, address2Literals, program, flatProgramAPI, keyPoolIterator.next()).createAndApply()
Expand All @@ -189,12 +188,15 @@ class Ghidra2Cpg() {
}

object Types {

// Types will be added to the CPG as soon as everything
// else is done
val types: ListBuffer[String] = ListBuffer[String]()
var types: mutable.SortedSet[String] = mutable.SortedSet[String]()
def registerType(typeName: String): String = {
types += typeName
try {
types += typeName
} catch {
case e: Exception => println(s" Error adding type: $typeName")
}
typeName
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class TypesPass(cpg: Cpg) extends CpgPass(cpg) {

override def run(): Iterator[DiffGraph] = {
implicit val diffGraph: DiffGraph.Builder = DiffGraph.newBuilder
Types.types.sorted.distinct
Types.types
.foreach { typ =>
val typeNode =
nodes.NewType().name(typ).fullName(typ).typeDeclFullName(typ)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class MipsFunctionPass(currentProgram: Program,
name = symbol.get.getName
}
}
if (name == null) {
name = input.getHigh.getSymbol.getName
}
createIdentifier(name,
name,
index + 1,
Expand Down