File: pem.rs

package info (click to toggle)
rust-rustls-pki-types 1.12.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 572 kB
  • sloc: makefile: 2; sh: 1
file content (26 lines) | stat: -rw-r--r-- 597 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#![no_main]

use std::io::Cursor;

use libfuzzer_sys::fuzz_target;

use rustls_pki_types::pem::PemObject;
use rustls_pki_types::{CertificateDer, PrivateKeyDer};

fuzz_target!(|data: &[u8]| {
    // cover the code paths that use std::io
    for x in CertificateDer::pem_reader_iter(&mut Cursor::new(data)) {
        match x {
            Ok(_item) => (),
            Err(_err) => break,
        }
    }

    // cover the code paths that use slices
    for x in PrivateKeyDer::pem_slice_iter(data) {
        match x {
            Ok(_item) => (),
            Err(_err) => break,
        }
    }
});