Skip to content

Commit a9c4427

Browse files
Fix CI for fuzzing
1 parent 28f974e commit a9c4427

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

fuzz/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ cargo-fuzz = true
1212
libfuzzer-sys = "0.4"
1313
arbitrary = { version = "1", features = ["derive"] }
1414
interchange = "0.3.0"
15+
heapless = "0.9.0"
1516

1617
[dependencies.apdu-dispatch]
1718
path = "../dispatch"

fuzz/fuzz_targets/fuzz_target_1.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
use apdu_dispatch::app::Result as AppResult;
33
use apdu_dispatch::{dispatch::Interface, interchanges, iso7816, App};
44
use arbitrary::{Arbitrary, Unstructured};
5+
use heapless::VecView;
56
use interchange::Channel;
67
use libfuzzer_sys::fuzz_target;
78

@@ -53,12 +54,12 @@ impl iso7816::App for FuzzAppImpl {
5354
}
5455
}
5556

56-
impl App<{ apdu_dispatch::response::SIZE }> for FuzzAppImpl {
57+
impl App for FuzzAppImpl {
5758
fn select(
5859
&mut self,
5960
_interface: iso7816::Interface,
6061
_apdu: apdu_dispatch::app::CommandView<'_>,
61-
_reply: &mut apdu_dispatch::response::Data,
62+
_reply: &mut heapless::VecView<u8>,
6263
) -> AppResult {
6364
Ok(())
6465
}
@@ -69,7 +70,7 @@ impl App<{ apdu_dispatch::response::SIZE }> for FuzzAppImpl {
6970
&mut self,
7071
_: Interface,
7172
_apdu: apdu_dispatch::app::CommandView<'_>,
72-
reply: &mut apdu_dispatch::response::Data,
73+
reply: &mut VecView<u8>,
7374
) -> AppResult {
7475
let (ref data, status) = &self.responses[self.count];
7576
reply.extend_from_slice(data).ok();
@@ -89,10 +90,7 @@ fuzz_target!(|input: Input| {
8990
.enumerate()
9091
.map(|(idx, app)| FuzzAppImpl::new(idx, app))
9192
.collect();
92-
let mut dyn_apps: Vec<_> = apps
93-
.iter_mut()
94-
.map(|s| (s as &mut dyn apdu_dispatch::App<7609>))
95-
.collect();
93+
let mut dyn_apps: Vec<&mut dyn apdu_dispatch::App> = apps.iter_mut().map(|s| s as _).collect();
9694

9795
let contact = Channel::new();
9896
let (mut contact_requester, contact_responder) = contact

0 commit comments

Comments
 (0)