MCPcopy Index your code
hub / github.com/Rust-API/Rust-API-Bypass-Checker / update_value_at

Method update_value_at

src/analysis/abstract_domain.rs:246–311  ·  view source on GitHub ↗

Updates the path to value map so that the given path now points to the given value.

(&mut self, path: Rc<Path>, value: Rc<SymbolicValue>)

Source from the content-addressed store, hash-verified

244
245 /// Updates the path to value map so that the given path now points to the given value.
246 pub fn update_value_at(&mut self, path: Rc<Path>, value: Rc<SymbolicValue>) {
247 debug!("Updating value at {:?}, value: {:?}", path, value);
248
249 if value.is_bottom() || value.is_top() {
250 self.numerical_domain.forget(&path);
251 self.nullness_domain.forget(&path);
252 return;
253 }
254
255 let nullness = self.infer_reference_nullness(&value);
256 self.update_nullness_at(&path, nullness);
257
258 match &value.expression {
259 Expression::Numerical(rpath) => {
260 self.numerical_domain
261 .assign_var(path.clone(), rpath.clone());
262 }
263 Expression::CompileTimeConstant(c) => {
264 if let Some(i) = c.try_get_integer() {
265 self.numerical_domain.assign_int(path.clone(), i);
266 } else {
267 self.numerical_domain.forget(&path);
268 }
269 }
270 Expression::Variable {
271 path: rpath,
272 var_type,
273 } if var_type.is_integer() => {
274 self.numerical_domain
275 .assign_var(path.clone(), rpath.clone());
276 }
277 Expression::Add { left, right } => {
278 if !self.assign_integer_binary_expression(
279 path.clone(),
280 NumericalOperation::Add,
281 left,
282 right,
283 ) {
284 self.numerical_domain.forget(&path);
285 }
286 }
287 Expression::Sub { left, right } => {
288 if !self.assign_integer_binary_expression(
289 path.clone(),
290 NumericalOperation::Sub,
291 left,
292 right,
293 ) {
294 self.numerical_domain.forget(&path);
295 }
296 }
297 Expression::Mul { left, right } => {
298 if !self.assign_integer_binary_expression(
299 path.clone(),
300 NumericalOperation::Mul,
301 left,
302 right,
303 ) {

Callers 15

visit_storage_deadMethod · 0.80
get_path_for_placeMethod · 0.80
visit_callMethod · 0.80
visit_rvalueMethod · 0.80
visit_aggregateMethod · 0.80
visit_nullary_opMethod · 0.80
visit_unary_opMethod · 0.80
visit_discriminantMethod · 0.80
visit_castMethod · 0.80

Calls 10

update_nullness_atMethod · 0.80
assign_varMethod · 0.80
try_get_integerMethod · 0.80
assign_intMethod · 0.80
is_integerMethod · 0.80
is_bottomMethod · 0.45
is_topMethod · 0.45
forgetMethod · 0.45

Tested by

no test coverage detected