From de9acf5d48151f1c9ca0b42d699e92b8502bebad Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Wed, 6 Apr 2022 02:18:56 +0200 Subject: [PATCH] usb/hid: fix infinite loop when N=0 --- embassy-usb-hid/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/embassy-usb-hid/src/lib.rs b/embassy-usb-hid/src/lib.rs index e29d485f..996de6a5 100644 --- a/embassy-usb-hid/src/lib.rs +++ b/embassy-usb-hid/src/lib.rs @@ -252,6 +252,7 @@ impl<'d, D: Driver<'d>, const N: usize> ReportReader<'d, D, N> { /// `read()`. If the dropped future used the same `buf`, then `buf` will /// contain the full report. pub async fn read(&mut self, buf: &mut [u8]) -> Result { + assert!(N != 0); assert!(buf.len() >= N); // Read packets from the endpoint