Static Value-Flow Analysis
Loading...
Searching...
No Matches
AbsExtAPI.h
Go to the documentation of this file.
1//===- AbsExtAPI.h -- Abstract Interpretation External API handler-----//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23
24//
25// Created by Jiawei Wang on 2024/9/9.
26//
27#pragma once
29#include "AE/Core/ICFGWTO.h"
31#include "AE/Svfexe/AbsExtAPI.h"
32#include "Util/SVFBugReport.h"
33#include "WPA/Andersen.h"
34
35namespace SVF
36{
37
38// Forward declaration of AbstractInterpretation class
39class AbstractInterpretation;
40
46{
47public:
53
59
63 void initExtFunMap();
64
71 std::string strRead(AbstractState& as, const SVFVar* rhs);
72
77 void handleExtAPI(const CallICFGNode *call);
78
83 void handleStrcpy(const CallICFGNode *call);
84
92
97 void handleStrcat(const SVF::CallICFGNode *call);
98
108
117
124
132
138 const SVFVar* getSVFVar(const SVFValue* val);
139
140protected:
144 Map<std::string, std::function<void(const CallICFGNode*)>> func_map;
145};
146
147} // namespace SVF
newitem type
Definition cJSON.cpp:2739
Handles external API calls and manages abstract states.
Definition AbsExtAPI.h:46
std::string strRead(AbstractState &as, const SVFVar *rhs)
Reads a string from the abstract state.
void handleMemset(AbstractState &as, const SVFVar *dst, IntervalValue elem, IntervalValue len)
Handles the memset API call.
void initExtFunMap()
Initializes the external function map.
Definition AbsExtAPI.cpp:38
IntervalValue getStrlen(AbstractState &as, const SVF::SVFVar *strValue)
Calculates the length of a string.
Map< const ICFGNode *, AbstractState > & abstractTrace
Map of ICFG nodes to abstract states.
Definition AbsExtAPI.h:143
void handleExtAPI(const CallICFGNode *call)
Handles an external API call.
AbstractState & getAbsStateFromTrace(const ICFGNode *node)
Retrieves the abstract state from the trace for a given ICFG node.
const SVFVar * getSVFVar(const SVFValue *val)
Retrieves the SVF variable from a given SVF value.
void handleMemcpy(AbstractState &as, const SVF::SVFVar *dst, const SVF::SVFVar *src, IntervalValue len, u32_t start_idx)
Handles the memcpy API call.
SVFIR * svfir
Pointer to the SVF intermediate representation.
Definition AbsExtAPI.h:141
void handleStrcat(const SVF::CallICFGNode *call)
Handles the strcat API call.
ExtAPIType
Enumeration of external API types.
Definition AbsExtAPI.h:52
IntervalValue getRangeLimitFromType(const SVFType *type)
Gets the range limit from a type.
ICFG * icfg
Pointer to the interprocedural control flow graph.
Definition AbsExtAPI.h:142
void handleStrcpy(const CallICFGNode *call)
Handles the strcpy API call.
Map< std::string, std::function< void(const CallICFGNode *)> > func_map
Map of function names to handlers.
Definition AbsExtAPI.h:144
for isBitcode
Definition BasicTypes.h:68
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
unsigned u32_t
Definition GeneralType.h:46