Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SMPStaticAnalyzer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Open Source Software
SMPStaticAnalyzer
Commits
732a3a9b
Commit
732a3a9b
authored
5 years ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
Added exception handling around EHP for processing non-linux binaries where EHP is ineffective.
parent
44cfc100
Branches
Branches containing commit
No related tags found
Loading
Checking pipeline status
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/interfaces/idapro/STARSInterface.cpp
+39
-31
39 additions, 31 deletions
src/interfaces/idapro/STARSInterface.cpp
with
39 additions
and
31 deletions
src/interfaces/idapro/STARSInterface.cpp
+
39
−
31
View file @
732a3a9b
...
...
@@ -477,38 +477,46 @@ bool STARS_IDA_Interface_t::AuditEHFunctionBoundaries(void) {
// Use the FDEs (Frame Descriptor Entries) from the eh_frame section
// to perform the same algorithm as above: an FDE should contain only one func.
const
string
ExeFileName
=
global_STARS_program
->
GetRootFileName
();
auto
EHParser
=
EHP
::
EHFrameParser_t
::
factory
(
ExeFileName
);
const
auto
FDEvecptr
=
EHParser
->
getFDEs
();
for
(
const
auto
FDEveciter
:
*
FDEvecptr
)
{
uint64_t
startAddr
=
FDEveciter
->
getStartAddress
();
uint64_t
endAddr
=
FDEveciter
->
getEndAddress
();
// See if start and end of FDE landing pad are in the same IDA Pro func.
STARS_ea_t
CurrStartEA
=
(
STARS_ea_t
)
startAddr
;
STARS_ea_t
CurrEndEA
=
(
STARS_ea_t
)
endAddr
;
func_t
*
StartFunc
=
::
get_func
(
CurrStartEA
);
func_t
*
EndFunc
=
::
get_func
(
CurrEndEA
-
1
);
if
(
StartFunc
!=
EndFunc
)
{
STARS_Segment_t
*
FuncSeg
=
this
->
getseg
(
CurrStartEA
);
assert
(
nullptr
!=
FuncSeg
);
char
SegName
[
STARS_MAXSTR
];
STARS_ssize_t
SegNameLen
=
FuncSeg
->
GetSegmentName
(
SegName
,
STARS_MAXSTR
-
1
);
assert
(
0
<
SegNameLen
);
const
bool
PLTflag
=
(
nullptr
!=
strstr
(
SegName
,
"plt"
));
const
bool
DYNflag
=
(
nullptr
!=
strstr
(
SegName
,
"dyn"
));
if
(
!
(
PLTflag
||
DYNflag
))
{
ProblemFound
=
true
;
SMP_msg
(
"INFO: FUNCBOUNDS: FDE range from %llx to %llx spans functions in segment %s
\n
"
,
(
uint64_t
)
CurrStartEA
,
(
uint64_t
)
(
CurrEndEA
-
1
),
SegName
);
bool
success
=
this
->
RedefineIDAFuncBounds
(
StartFunc
,
EndFunc
,
CurrStartEA
,
CurrEndEA
);
if
(
success
)
SMP_msg
(
"INFO: Redefined IDA FuncBounds successfully.
\n
"
);
else
SMP_msg
(
"ERROR: Failed to redefine IDA FuncBounds.
\n
"
);
try
{
auto
EHParser
=
EHP
::
EHFrameParser_t
::
factory
(
ExeFileName
);
const
auto
FDEvecptr
=
EHParser
->
getFDEs
();
for
(
const
auto
FDEveciter
:
*
FDEvecptr
)
{
uint64_t
startAddr
=
FDEveciter
->
getStartAddress
();
uint64_t
endAddr
=
FDEveciter
->
getEndAddress
();
// See if start and end of FDE landing pad are in the same IDA Pro func.
STARS_ea_t
CurrStartEA
=
(
STARS_ea_t
)
startAddr
;
STARS_ea_t
CurrEndEA
=
(
STARS_ea_t
)
endAddr
;
func_t
*
StartFunc
=
::
get_func
(
CurrStartEA
);
func_t
*
EndFunc
=
::
get_func
(
CurrEndEA
-
1
);
if
(
StartFunc
!=
EndFunc
)
{
STARS_Segment_t
*
FuncSeg
=
this
->
getseg
(
CurrStartEA
);
assert
(
nullptr
!=
FuncSeg
);
char
SegName
[
STARS_MAXSTR
];
STARS_ssize_t
SegNameLen
=
FuncSeg
->
GetSegmentName
(
SegName
,
STARS_MAXSTR
-
1
);
assert
(
0
<
SegNameLen
);
const
bool
PLTflag
=
(
nullptr
!=
strstr
(
SegName
,
"plt"
));
const
bool
DYNflag
=
(
nullptr
!=
strstr
(
SegName
,
"dyn"
));
if
(
!
(
PLTflag
||
DYNflag
))
{
ProblemFound
=
true
;
SMP_msg
(
"INFO: FUNCBOUNDS: FDE range from %llx to %llx spans functions in segment %s
\n
"
,
(
uint64_t
)
CurrStartEA
,
(
uint64_t
)
(
CurrEndEA
-
1
),
SegName
);
bool
success
=
this
->
RedefineIDAFuncBounds
(
StartFunc
,
EndFunc
,
CurrStartEA
,
CurrEndEA
);
if
(
success
)
SMP_msg
(
"INFO: Redefined IDA FuncBounds successfully.
\n
"
);
else
SMP_msg
(
"ERROR: Failed to redefine IDA FuncBounds.
\n
"
);
}
}
}
}
// end for (const auto FDEveciter : *FDEvecptr)
}
// end for (const auto FDEveciter : *FDEvecptr)
}
catch
(
const
std
::
exception
&
e
)
{
const
auto
msg
=
string
(
"WARN: Unhandled exception when processing EH frame: "
)
+
e
.
what
();
SMP_msg
(
msg
.
c_str
());
}
#endif // __X64__
#endif // STARS_USE_EHP_LIB
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment