From 9e83ea144de09b78a696a0a9997ec28e3bc55327 Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Wed, 27 Aug 2025 07:32:25 -0700 Subject: Ensure that auto call type adjustments don't overwrite user call type adjustments of the same confidence A call type adjustment set via `SetAutoCallTypeAdjustment` will only take effect if any existing call type adjustment, automatic or user-defined, is of a lower confidence level. This ensures that user call type adjustments with full confidence will not be overridden by a workflow. Similar changes have been made to `SetAutoCallStackAdjustment`, `SetAutoInlinedDuringAnalysis` and the overload of `SetAutoCallRegisterStackAdjustment` that adjusts a single register stack. --- binaryninjaapi.h | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 56009438..fd926ebd 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -12435,12 +12435,53 @@ namespace BinaryNinja { std::vector GetUnresolvedIndirectBranches(); bool HasUnresolvedIndirectBranches(); + /*! \brief Apply an automatic type adjustment to the call at `addr` in `arch`. + + The adjustment will take effect if the new confidence level is higher than the confidence + level of any existing adjustment at the given address, whether automatic or user-defined. + + \param arch Architecture for the call instruction + \param addr Address of the call instruction + \param adjust Type adjustment to apply + */ void SetAutoCallTypeAdjustment(Architecture* arch, uint64_t addr, const Confidence>& adjust); + + /*! \brief Apply an automatic stack adjustment to the call at `addr` in `arch`. + + The adjustment will take effect if the new confidence level is higher than the confidence + level of any existing adjustment at the given address, whether automatic or user-defined. + + \param arch Architecture for the call instruction + \param addr Address of the call instruction + \param adjust Stack adjustment to apply + */ void SetAutoCallStackAdjustment(Architecture* arch, uint64_t addr, const Confidence& adjust); + + /*! \brief Apply automatic register stack adjustments to the call at `addr` in `arch`. + + \note This overwrites any existing register stack adjustments at the given address, + irrespective of their confidence level. + + \param arch Architecture for the call instruction + \param addr Address of the call instruction + \param adjust Map of register stack adjustments to apply + */ void SetAutoCallRegisterStackAdjustment( Architecture* arch, uint64_t addr, const std::map>& adjust); + + /*! \brief Apply an automatic register stack adjustment for a specific register stack to the call at `addr` in `arch`. + + The adjustment will take effect if the new confidence level is higher than the confidence + level of any existing adjustment at the given address, whether automatic or user-defined. + + \param arch Architecture for the call instruction + \param addr Address of the call instruction + \param regStack Register stack identifier + \param adjust Register stack adjustment to apply + */ void SetAutoCallRegisterStackAdjustment( Architecture* arch, uint64_t addr, uint32_t regStack, const Confidence& adjust); + void SetUserCallTypeAdjustment(Architecture* arch, uint64_t addr, const Confidence>& adjust); void SetUserCallStackAdjustment(Architecture* arch, uint64_t addr, const Confidence& adjust); void SetUserCallRegisterStackAdjustment( @@ -12641,6 +12682,15 @@ namespace BinaryNinja { bool GetInstructionContainingAddress(Architecture* arch, uint64_t addr, uint64_t* start); Confidence IsInlinedDuringAnalysis(); + /*! Set whether the function should be inlined during analysis. + + This will take effect if the new confidence level is higher than the confidence + level of the existing value of `IsInlinedDuringAnalysis`, whether automatic or + user-defined. + + \param inlined Whether the function should be inlined. + + */ void SetAutoInlinedDuringAnalysis(Confidence inlined); void SetUserInlinedDuringAnalysis(Confidence inlined); -- cgit v1.3.1