MCPcopy Create free account
hub / github.com/Rust-API/Rust-API-Bypass-Checker / refine_paths

Method refine_paths

src/analysis/memory/symbolic_value.rs:259–340  ·  view source on GitHub ↗

Replaces occurrences of Expression::Variable(path) with the value at that path in the given environment (if there is such a value).

(&self, environment: &AbstractDomain<DomainType>)

Source from the content-addressed store, hash-verified

257 /// Replaces occurrences of Expression::Variable(path) with the value at that path
258 /// in the given environment (if there is such a value).
259 fn refine_paths(&self, environment: &AbstractDomain<DomainType>) -> Rc<SymbolicValue> {
260 match &self.expression {
261 Expression::Drop(..) => self.clone(),
262 Expression::Numerical(..) => self.clone(),
263 Expression::Bottom | Expression::Top => self.clone(),
264 Expression::And { left, right } => left
265 .refine_paths(environment)
266 .and(right.refine_paths(environment)),
267 Expression::CompileTimeConstant(..) => self.clone(),
268 Expression::Cast {
269 operand,
270 target_type,
271 } => operand.refine_paths(environment).cast(target_type.clone()),
272 Expression::Equals { left, right } => left
273 .refine_paths(environment)
274 .equals(right.refine_paths(environment)),
275 Expression::GreaterOrEqual { left, right } => left
276 .refine_paths(environment)
277 .greater_or_equal(right.refine_paths(environment)),
278 Expression::GreaterThan { left, right } => left
279 .refine_paths(environment)
280 .greater_than(right.refine_paths(environment)),
281 Expression::HeapBlock { .. } => self.clone(),
282 Expression::Join { left, right } => left
283 .refine_paths(environment)
284 .join(right.refine_paths(environment)),
285 Expression::LessOrEqual { left, right } => left
286 .refine_paths(environment)
287 .less_or_equal(right.refine_paths(environment)),
288 Expression::LessThan { left, right } => left
289 .refine_paths(environment)
290 .less_than(right.refine_paths(environment)),
291 Expression::Ne { left, right } => left
292 .refine_paths(environment)
293 .not_equals(right.refine_paths(environment)),
294 Expression::Mul { left, right } => left
295 .refine_paths(environment)
296 .mul(right.refine_paths(environment)),
297 Expression::LogicalNot { operand } => operand.refine_paths(environment).logical_not(),
298 Expression::Or { left, right } => left
299 .refine_paths(environment)
300 .or(right.refine_paths(environment)),
301 Expression::Reference(path) => {
302 let refined_path = path.refine_paths(environment);
303 SymbolicValue::make_reference(refined_path)
304 }
305 Expression::Variable { path, var_type } => {
306 if let Some(val) = environment.value_at(&path) {
307 val
308 } else {
309 let refined_path = path.refine_paths(environment);
310 if let PathEnum::Alias { value } = &refined_path.value {
311 value.clone()
312 } else if let Some(val) = environment.value_at(&refined_path) {
313 val
314 } else if refined_path == *path {
315 self.clone()
316 } else {

Callers

nothing calls this directly

Calls 15

andMethod · 0.80
orMethod · 0.80
value_atMethod · 0.80
widenMethod · 0.80
offsetMethod · 0.80
castMethod · 0.45
equalsMethod · 0.45
greater_or_equalMethod · 0.45
greater_thanMethod · 0.45
joinMethod · 0.45
less_or_equalMethod · 0.45
less_thanMethod · 0.45

Tested by

no test coverage detected