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

Function is_file_name

src/program/infer/static_infer.rs:465–485  ·  view source on GitHub ↗
(arg: &Node, visitor: &Visitor)

Source from the content-addressed store, hash-verified

463 use super::*;
464
465 pub fn is_file_name(arg: &Node, visitor: &Visitor) -> bool {
466 let arg = strip_prefix(arg);
467 let input_re = Regex::new(r"^input_file(\.\w+)?$").unwrap();
468 let output_re = Regex::new(r"^output_file(\.\w+)?$").unwrap();
469 if let Clang::StringLiteral(sl) = &arg.kind {
470 let value = sl.get_eval_value();
471 // special case for sqlite3 and libmagic
472 if value == ":memory:" || value == "magic" {
473 return true;
474 }
475 if input_re.is_match(&value) || output_re.is_match(&value) {
476 return true;
477 }
478 }
479 if let Clang::DeclRefExpr(dre) = &arg.kind {
480 if let Some(init) = dre.get_var_init(visitor) {
481 return is_file_name(init, visitor);
482 }
483 }
484 false
485 }
486
487 pub fn is_file_descriptor(arg: &Node, visitor: &Visitor) -> bool {
488 let arg = strip_prefix(arg);

Callers 2

infer_constraintsFunction · 0.85

Calls 3

strip_prefixFunction · 0.85
get_eval_valueMethod · 0.80
get_var_initMethod · 0.80

Tested by

no test coverage detected