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

Method add_fuzzer_size_constraint

src/program/transform.rs:463–472  ·  view source on GitHub ↗

Add the size_t constriant for the fuzzer input.

(&mut self, size_stmt: &str)

Source from the content-addressed store, hash-verified

461
462 /// Add the size_t constriant for the fuzzer input.
463 pub fn add_fuzzer_size_constraint(&mut self, size_stmt: &str) -> Result<()> {
464 let visitor = self.get_new_visitor()?;
465 let ins_loc = visitor.get_function_body_begin_loc()?;
466 let constraint = format!(
467 "\n\tif({size_stmt}<{}) return 0;\n",
468 self.fuzzer_shim.get_offset()
469 );
470 self.seek_and_rewrite(ins_loc, 0, &constraint)?;
471 Ok(())
472 }
473
474 fn write_fuzzer_vars_stmts(&mut self) -> Result<()> {
475 let fuzzer_stmts = self.fuzzer_shim.serialize_fuzzer_stmts();

Callers 2

transform_to_fuzzerMethod · 0.80
preprocessMethod · 0.80

Calls 3

get_new_visitorMethod · 0.80
seek_and_rewriteMethod · 0.80

Tested by

no test coverage detected