Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6846eb2
refactor AE, use worklist algorithm(naive)
Jan 26, 2026
353871d
sync with SSA Ass3
Jan 28, 2026
3847a44
refactor recursion
Jan 29, 2026
b7be147
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Jan 31, 2026
e7f18f8
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Jan 31, 2026
500c22f
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Feb 2, 2026
94ab144
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Feb 2, 2026
809a397
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Feb 2, 2026
ec7f7ca
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Feb 2, 2026
8b0605c
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Feb 2, 2026
e6942d5
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Feb 2, 2026
9c72e10
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Feb 2, 2026
e0d7674
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Feb 2, 2026
bf793f8
rename handleICFGCycle
Feb 3, 2026
09e86d5
Continue to reduce the Options() handleRecur. (vibe-kanban 5f1e98b0)
Feb 3, 2026
76c2374
rename two functions in AbstractInterpretation (vibe-kanban 313b27a9)
Feb 4, 2026
7fce768
rename two functions in AbstractInterpretation (vibe-kanban 313b27a9)
Feb 4, 2026
d3b4fae
rename two functions in AbstractInterpretation (vibe-kanban 313b27a9)
Feb 4, 2026
4c87a38
Add multi-entry whole-program analysis for library code
Feb 6, 2026
7444f96
Add -ae-multientry option for multi-entry analysis
Feb 6, 2026
2aa167c
Fix handleICFGNode regression in function entry state handling
Feb 6, 2026
afb1b8f
Fix assertion errors in AE for multi-entry analysis
Feb 6, 2026
17c751c
fix merge conflict
Feb 7, 2026
bbb2c39
Some Rename and Refactor
Feb 8, 2026
d70d6fa
Read the comments in PullRequest (vibe-kanban 78898480)
Feb 8, 2026
4d364ff
Read the comments in PullRequest (vibe-kanban 78898480)
Feb 8, 2026
c0b4582
Read the comments in PullRequest (vibe-kanban 78898480)
Feb 10, 2026
1bdb795
Read the comments in PullRequest (vibe-kanban 78898480)
Feb 10, 2026
f5d8994
1) use andersen pts to do function ptr 2) refactor blackhole for big …
Feb 13, 2026
586a522
revoke and remove some functions
Feb 13, 2026
ade5b61
refactor some bug fixes in String handler
Feb 13, 2026
1ef5e40
fix for comments
Feb 14, 2026
aa86754
fix ci
Feb 14, 2026
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
44 changes: 12 additions & 32 deletions svf/include/AE/Svfexe/AbsExtAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,43 +74,23 @@ class AbsExtAPI
*/
void handleExtAPI(const CallICFGNode *call);

/**
* @brief Handles the strcpy API call.
* @param call Pointer to the call ICFG node.
*/
void handleStrcpy(const CallICFGNode *call);
// --- Shared primitives used by string/memory handlers ---

/**
* @brief Calculates the length of a string.
* @param as Reference to the abstract state.
* @param strValue Pointer to the SVF variable representing the string.
* @return The interval value representing the string length.
*/
/// Get the byte size of each element for a pointer/array variable.
u32_t getElementSize(AbstractState& as, const SVFVar* var);

/// Check if an interval length is usable (not bottom, not unbounded).
static bool isValidLength(const IntervalValue& len);

/// Calculate the length of a null-terminated string in abstract state.
IntervalValue getStrlen(AbstractState& as, const SVF::SVFVar *strValue);

/**
* @brief Handles the strcat API call.
* @param call Pointer to the call ICFG node.
*/
void handleStrcat(const SVF::CallICFGNode *call);
// --- String/memory operation handlers ---

/**
* @brief Handles the memcpy API call.
* @param as Reference to the abstract state.
* @param dst Pointer to the destination SVF variable.
* @param src Pointer to the source SVF variable.
* @param len The interval value representing the length to copy.
* @param start_idx The starting index for copying.
*/
void handleStrcpy(const CallICFGNode *call);
void handleStrcat(const CallICFGNode *call);
void handleStrncat(const CallICFGNode *call);
void handleMemcpy(AbstractState& as, const SVF::SVFVar *dst, const SVF::SVFVar *src, IntervalValue len, u32_t start_idx);

/**
* @brief Handles the memset API call.
* @param as Reference to the abstract state.
* @param dst Pointer to the destination SVF variable.
* @param elem The interval value representing the element to set.
* @param len The interval value representing the length to set.
*/
void handleMemset(AbstractState& as, const SVFVar* dst, IntervalValue elem, IntervalValue len);

/**
Expand Down
12 changes: 12 additions & 0 deletions svf/include/AE/Svfexe/AbstractInterpretation.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include "Util/SVFBugReport.h"
#include "Util/SVFStat.h"
#include "Graphs/SCC.h"
#include "Graphs/CallGraph.h"
#include <deque>

namespace SVF
{
Expand Down Expand Up @@ -144,6 +146,13 @@ class AbstractInterpretation
/// Program entry
void analyse();

/// Analyze all entry points (functions without callers)
void analyzeFromAllProgEntries();

/// Get all entry point functions (functions without callers)
std::deque<const FunObjVar*> collectProgEntryFuns();


static AbstractInterpretation& getAEInstance()
{
static AbstractInterpretation instance;
Expand Down Expand Up @@ -322,6 +331,8 @@ class AbstractInterpretation
AEAPI* api{nullptr};

ICFG* icfg;
CallGraph* callGraph;
CallGraphSCC* callGraphScc;
AEStat* stat;

std::vector<const CallICFGNode*> callSiteStack;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this callSiteStack? Where this has been used apart from push/pop?

Expand Down Expand Up @@ -358,6 +369,7 @@ class AbstractInterpretation
Map<std::string, std::function<void(const CallICFGNode*)>> func_map;

Map<const ICFGNode*, AbstractState> abstractTrace; // abstract states immediately after nodes
Set<const ICFGNode*> allAnalyzedNodes; // All nodes ever analyzed (across all entry points)
std::string moduleName;

std::vector<std::unique_ptr<AEDetector>> detectors;
Expand Down
18 changes: 17 additions & 1 deletion svf/lib/AE/Svfexe/AEDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,23 @@ bool BufOverflowDetector::canSafelyAccessMemory(AbstractState& as, const SVF::SV
SVFIR* svfir = PAG::getPAG();
NodeID value_id = value->getId();

assert(as[value_id].isAddr());
// Lazy initialization for uninitialized pointer parameters in multi-entry analysis.
// When analyzing a function as an entry point (e.g., not called from main),
// pointer parameters may not have been initialized via AddrStmt.
//
// Example:
// void process_buffer(char* buf, int len) {
// buf[0] = 'a'; // accessing buf
// }
// When analyzing process_buffer as an entry point, 'buf' is a function parameter
// with no AddrStmt, so it has no address information in the abstract state.
// We lazily initialize it to point to the black hole object (BlkPtr), representing
// an unknown but valid memory location. This allows the analysis to continue
// while being conservatively sound.
if (!as[value_id].isAddr())
{
as[value_id] = AddressValue(InvalidMemAddr);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to rename InvalidMemAddr to be BlackHoleObjAddr.

}
for (const auto& addr : as[value_id].getAddrs())
{
NodeID objId = as.getIDFromAddr(addr);
Expand Down
Loading
Loading