-
-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add different types of RzGraphNodeInfos. (#4189)
* Add different types of GraphNodeInfos. This adds support for multiple graph node infos. It removes the assumption that information of a graph node must be some strings and an offset. * Increase buffer for printing graph node body * Don't hardcode maximum label size * Add graph node info for icfg * Add node type info to CFG. * Access address members properly for iCFG and CFG nodes * Update test. Function names are no longer saved. * Fix reachable double free of label * Split graph node type from its sub-type to make it less confusing. * Add integration tests for iCFG nodes. * Fix, add mising buffer read * Recognize more calls * Add test for iCFG generation and its node details.
- Loading branch information
Showing
9 changed files
with
605 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
// SPDX-FileCopyrightText: 2010-2021 pancake <[email protected]> | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
#include <rz_util/rz_regex.h> | ||
#include <rz_analysis.h> | ||
#include <rz_parse.h> | ||
#include <rz_util.h> | ||
|
@@ -2692,3 +2693,21 @@ RZ_API RZ_OWN RzCallable *rz_analysis_function_derive_type(RzAnalysis *analysis, | |
} | ||
return callable; | ||
} | ||
|
||
/** | ||
* \brief Determines if the given function is a memory allocating function (malloc, calloc etc.). | ||
* | ||
* The current methods of detection (tested in order): | ||
* - Name matches regex ".*\.([mc]|(re))?alloc.*" | ||
* | ||
* \param fcn The function to test. | ||
* | ||
* \return true If the function \p fcn is considered a memory allocating. | ||
* \return false Otherwise. | ||
*/ | ||
RZ_API bool rz_analysis_function_is_malloc(const RzAnalysisFunction *fcn) { | ||
rz_return_val_if_fail(fcn, false); | ||
// TODO We need more metrics here. Just the name is pretty naive. | ||
// E.g. we should compare it to signatures and other characterisitics. | ||
return rz_regex_contains(".*\\.([mc]|(re))?alloc.*", fcn->name, RZ_REGEX_ZERO_TERMINATED, RZ_REGEX_EXTENDED, RZ_REGEX_DEFAULT); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.