MCPcopy Create free account
hub / github.com/FuzzAnything/PromptFuzz / refine_file_name_constraint

Function refine_file_name_constraint

src/program/infer/static_infer.rs:419–431  ·  view source on GitHub ↗

LLM is possible to assign a string argument with "input_file" name, so check whether this constraint is well inferred

(func: &str, constraints: Vec<Constraint>)

Source from the content-addressed store, hash-verified

417
418/// LLM is possible to assign a string argument with "input_file" name, so check whether this constraint is well inferred
419fn refine_file_name_constraint(func: &str, constraints: Vec<Constraint>) -> Vec<Constraint> {
420 let mut retained = Vec::new();
421 let deopt = Deopt::new(get_library_name()).unwrap();
422 for constraint in constraints {
423 if let Constraint::FileName(arg_pos) = constraint {
424 if !check_func_arg_is_file_name(func, arg_pos, &deopt).unwrap() {
425 continue;
426 }
427 }
428 retained.push(constraint);
429 }
430 retained
431}
432
433fn check_func_arg_is_file_name(func: &str, arg_pos: usize, deopt: &Deopt) -> Result<bool> {
434 let succ_seeds = deopt.get_library_succ_seed_dir()?;

Callers 1

refine_constraintsFunction · 0.85

Calls 3

get_library_nameFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected