]> git.bitcoin.ninja Git - dnssec-prover/commitdiff
Call `RR.json()` when deserializing RRs in fuzzing
authorMatt Corallo <git@bluematt.me>
Tue, 9 Jul 2024 20:32:39 +0000 (20:32 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 9 Jul 2024 21:11:12 +0000 (21:11 +0000)
To improve coverage

src/ser.rs

index 3cb3c89f2814bddd05566cd9ad88f49bbcf4a62d..30ab302dcbeb894356147233b6492a2cdaa8510b 100644 (file)
@@ -173,7 +173,10 @@ pub(crate) fn parse_rr(inp: &mut &[u8]) -> Result<RR, ()> {
 pub fn parse_rr_stream(mut inp: &[u8]) -> Result<Vec<RR>, ()> {
        let mut res = Vec::with_capacity(32);
        while !inp.is_empty() {
-               res.push(parse_rr(&mut inp)?);
+               let rr = parse_rr(&mut inp)?;
+               #[cfg(fuzzing)]
+               let _ = rr.json(); // Make sure we can JSON the RR when fuzzing, cause why not
+               res.push(rr);
        }
        Ok(res)
 }