From a97b053840d4b6590f0cf0d7a5e07fb73cb0baea Mon Sep 17 00:00:00 2001 From: JoelYYoung <56264140+JoelYYoung@users.noreply.github.com> Date: Tue, 25 Aug 2026 11:20:47 +1000 Subject: [PATCH] Clarify Assignment 3 traversal TODOs --- Assignment-3/Assignment-3.cpp | 29 +++++++++++++++++------------ Assignment-3/Assignment-3.h | 15 +++++++++------ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Assignment-3/Assignment-3.cpp b/Assignment-3/Assignment-3.cpp index 429b81d..1e86c32 100644 --- a/Assignment-3/Assignment-3.cpp +++ b/Assignment-3/Assignment-3.cpp @@ -37,17 +37,6 @@ using namespace SVF; using namespace llvm; using namespace std; -/// TODO: Implement your context-sensitive ICFG traversal here to traverse each program path -/// by matching calls and returns while maintaining a `callstack`. -/// Sources and sinks are identified by implementing and calling `readSrcSnkFromFile` -/// Each path including loops, qualified by a `callstack`, should only be traversed once using a `visited` set. -/// You will need to collect each path from src to snk and then add the path to the `paths` set. -/// Add each path (a sequence of node IDs) as a string into std::set paths -/// in the format "START->1->2->4->5->END", where -> indicate an ICFGEdge connects two ICFGNode IDs -void ICFGTraversal::reachability(const ICFGNode* src, const ICFGNode* dst) { - -} - /// TODO: Implement your code to parse the two lines to identify sources and sinks from `SrcSnk.txt` for your /// reachability analysis The format in SrcSnk.txt is in the form of /// line 1 for sources "{ api1 api2 api3 }" @@ -55,6 +44,22 @@ void ICFGTraversal::reachability(const ICFGNode* src, const ICFGNode* dst) { void ICFGTraversal::readSrcSnkFromFile(const string& filename) { +} + +/// TODO: Convert each collected ICFG path into a string and insert it into +/// `std::set paths`. The path should use the format +/// "START->1->2->4->5->END", where each pair of adjacent node IDs is connected +/// by an ICFG edge, similar to Assignment 2. +void ICFGTraversal::collectICFGPath(std::vector& path) { + +} + +/// TODO: Implement context-sensitive ICFG traversal from `src` to `snk` by +/// matching call and return edges while maintaining a `callstack`. Each path, +/// including loops and qualified by its callstack, should only be traversed +/// once using `visited`. Call `collectICFGPath` for every reachable path. +void ICFGTraversal::reachability(const ICFGNode* src, const ICFGNode* snk) { + } // TODO: Implement your Andersen's Algorithm here @@ -113,4 +118,4 @@ void AndersenPTA::analyze() { reanalyze = true; } while (reanalyze); finalize(); -} \ No newline at end of file +} diff --git a/Assignment-3/Assignment-3.h b/Assignment-3/Assignment-3.h index ff420af..41fa6c7 100644 --- a/Assignment-3/Assignment-3.h +++ b/Assignment-3/Assignment-3.h @@ -80,14 +80,17 @@ class ICFGTraversal { ICFGTraversal(SVFIR* p) : pag(p) {} - /// TODO: to be implemented context sensitive reachability - void reachability(const ICFGNode* curNode, const ICFGNode* sink); + /// TODO: Configure source and sink function names from SrcSnk.txt + void readSrcSnkFromFile(const std::string& filename); - // Return true if two pointers are aliases - bool aliasCheck(const CallICFGNode* src, const CallICFGNode* snk); + /// TODO: Convert and store a collected ICFG path + void collectICFGPath(std::vector& path); - // TODO: Source and sink function names read from SrcSnk.txt - void readSrcSnkFromFile(const std::string& filename); + /// TODO: Perform context-sensitive reachability and collect reachable paths + void reachability(const ICFGNode* src, const ICFGNode* snk); + + /// TODO: Return true if the source return value aliases a sink argument + bool aliasCheck(const CallICFGNode* src, const CallICFGNode* snk); // The driver method for taint checking void taintChecking();