/src/arm-ffa/fuzz/fuzz_targets/boot_info.rs
Line | Count | Source |
1 | | // SPDX-FileCopyrightText: Copyright The arm-ffa Contributors. |
2 | | // SPDX-License-Identifier: MIT OR Apache-2.0 |
3 | | |
4 | | //! Unpacks boot info descriptors from the test data then packs them. |
5 | | |
6 | | #![no_main] |
7 | | |
8 | | use arm_ffa::boot_info::BootInfo; |
9 | | use libfuzzer_sys::fuzz_target; |
10 | | |
11 | | fuzz_target!(|data: &[u8]| { |
12 | | let _ = BootInfo::get_blob_size(data); |
13 | | |
14 | | let Ok(iterator) = BootInfo::unpack(data) else { |
15 | | return; |
16 | | }; |
17 | | |
18 | 37.8k | let descriptors: Vec<_> = iterator.filter_map(|it| it.ok()).collect(); |
19 | | |
20 | | let mut buf_out = vec![0; data.len() * 2]; |
21 | | BootInfo::pack(&descriptors, &mut buf_out, None); |
22 | | }); |