Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cwe_checker
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-depend
cwe_checker
Commits
cd7ba4cf
Unverified
Commit
cd7ba4cf
authored
Nov 03, 2020
by
Melvin Klimke
Committed by
GitHub
Nov 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix empty address for stack param and MIPS delay slots (#98)
parent
6313165c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
PcodeExtractor.java
ghidra/p_code_extractor/PcodeExtractor.java
+7
-2
No files found.
ghidra/p_code_extractor/PcodeExtractor.java
View file @
cd7ba4cf
...
...
@@ -274,10 +274,15 @@ public class PcodeExtractor extends GhidraScript {
* Checks whether the assembly instruction is a nop instruction and adds a jump to the block.
* Checks whether a jump occured within a ghidra generated pcode block and fixes the control flow
* by adding missing jumps between artificially generated blocks.
* Checks whether an instruction is in a delay slot and, if so, ignores it
* as Ghidra already includes the instruction before the jump
*/
protected
void
analysePcodeBlockOfAssemblyInstruction
()
{
PcodeBlockData
.
ops
=
PcodeBlockData
.
instruction
.
getPcode
(
true
);
if
(
PcodeBlockData
.
ops
.
length
==
0
&&
!
PcodeBlockData
.
instruction
.
isInDelaySlot
())
{
if
(
PcodeBlockData
.
instruction
.
isInDelaySlot
())
{
return
;
}
if
(
PcodeBlockData
.
ops
.
length
==
0
)
{
addJumpToCurrentBlock
(
PcodeBlockData
.
blocks
.
get
(
PcodeBlockData
.
blocks
.
size
()-
1
).
getTerm
(),
PcodeBlockData
.
instruction
.
getAddress
().
toString
(),
PcodeBlockData
.
instruction
.
getFallThrough
().
toString
(),
null
);
if
(
PcodeBlockData
.
instructionIndex
<
PcodeBlockData
.
numberOfInstructionsInBlock
-
1
)
{
PcodeBlockData
.
blocks
.
add
(
createBlkTerm
(
PcodeBlockData
.
instruction
.
getFallThrough
().
toString
(),
null
));
...
...
@@ -1089,7 +1094,7 @@ public class PcodeExtractor extends GhidraScript {
* Removes stack prefix from stack parameter. e.g. Stack[0x4] => 0x4
*/
protected
String
removeStackPrefix
(
String
param
)
{
Matcher
matcher
=
Pattern
.
compile
(
"^Stack\\[(
0x\\d
)\\]$"
).
matcher
(
param
);
Matcher
matcher
=
Pattern
.
compile
(
"^Stack\\[(
[a-zA-Z0-9]*
)\\]$"
).
matcher
(
param
);
if
(
matcher
.
find
())
{
return
matcher
.
group
(
1
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment