diff --git a/libafl/src/common/nautilus/grammartec/context.rs b/libafl/src/common/nautilus/grammartec/context.rs index c29901b9fd..cd4068d014 100644 --- a/libafl/src/common/nautilus/grammartec/context.rs +++ b/libafl/src/common/nautilus/grammartec/context.rs @@ -357,6 +357,8 @@ mod tests { tree::{Tree, TreeLike}, }; + // Some (but not all) versions of clippy think the from_nt things are format strings. + #[allow(clippy::literal_string_with_formatting_args)] #[test] fn simple_context() { let mut ctx = Context::new(); diff --git a/libafl/src/common/nautilus/grammartec/python_grammar_loader.rs b/libafl/src/common/nautilus/grammartec/python_grammar_loader.rs index 7ed7ab5f9b..061b15238c 100644 --- a/libafl/src/common/nautilus/grammartec/python_grammar_loader.rs +++ b/libafl/src/common/nautilus/grammartec/python_grammar_loader.rs @@ -1,4 +1,6 @@ -use std::{string::String, vec::Vec}; +#![allow(clippy::useless_conversion)] // This seems to be a false-positive(?) + +use std::{ffi::CString, string::String, vec::Vec}; use pyo3::{prelude::*, pyclass, types::IntoPyDict}; @@ -48,8 +50,8 @@ impl PyContext { fn loader(py: Python, grammar: &str) -> PyResult { let py_ctx = Bound::new(py, PyContext::new())?; - let locals = [("ctx", &py_ctx)].into_py_dict_bound(py); - py.run_bound(grammar, None, Some(&locals))?; + let locals = [("ctx", &py_ctx)].into_py_dict(py)?; + py.run(&CString::new(grammar)?, None, Some(&locals))?; Ok(py_ctx.borrow().get_context()) } diff --git a/libafl/src/common/nautilus/grammartec/tree.rs b/libafl/src/common/nautilus/grammartec/tree.rs index d330076736..b8f46061f8 100644 --- a/libafl/src/common/nautilus/grammartec/tree.rs +++ b/libafl/src/common/nautilus/grammartec/tree.rs @@ -85,13 +85,13 @@ impl<'data, 'tree: 'data, 'ctx: 'data, W: Write, T: TreeLike> Unparser<'data, 't .into_iter() .map(io::Cursor::into_inner) .collect::>(); - let byte_arrays = bufs.iter().map(|b| PyBytes::new_bound(py, b)); - let res = expr.call1(py, PyTuple::new_bound(py, byte_arrays))?; + let byte_arrays = bufs.iter().map(|b| PyBytes::new(py, b)); + let res = expr.call1(py, PyTuple::new(py, byte_arrays)?)?; let bound = res.bind(py); - if PyString::is_type_of_bound(bound) { + if PyString::is_type_of(bound) { let pystr = bound.downcast::()?; self.write(pystr.to_string_lossy().as_bytes()); - } else if PyBytes::is_type_of_bound(bound) { + } else if PyBytes::is_type_of(bound) { let pybytes = bound.downcast::()?; self.write(pybytes.as_bytes()); } else { diff --git a/libafl_qemu/src/qemu/usermode.rs b/libafl_qemu/src/qemu/usermode.rs index 33b31e326c..f9549ede64 100644 --- a/libafl_qemu/src/qemu/usermode.rs +++ b/libafl_qemu/src/qemu/usermode.rs @@ -286,7 +286,9 @@ pub mod pybind { a6: u64, a7: u64, ) -> SyscallHookResult { - unsafe { &*(&raw const PY_SYSCALL_HOOK).as_ref() }.map_or_else( + // If we don't deref_addrof we run into the "static-mut-references" lint which is worse. + #[expect(clippy::deref_addrof)] + unsafe { (*(&raw const PY_SYSCALL_HOOK)).as_ref() }.map_or_else( || SyscallHookResult::new(None), |obj| { let args = (sys_num, a0, a1, a2, a3, a4, a5, a6, a7);