From 108034b050e1fc3819d542bed539b5946131d7d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Mon, 10 Dec 2018 14:02:47 +0100 Subject: [PATCH] packet_stream: packets w/o payload are still valid Packets whose data is stored within the Packet_descriptor itself but not as payload, .e.g Usb::Packet_descriptor, are valid packets after all. So loosen the packet valid check for zero-sized packets is reasonable. Fixes #3076. --- repos/os/include/os/packet_stream.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/os/include/os/packet_stream.h b/repos/os/include/os/packet_stream.h index 3a797d32ea..2da193e89c 100644 --- a/repos/os/include/os/packet_stream.h +++ b/repos/os/include/os/packet_stream.h @@ -538,7 +538,7 @@ class Genode::Packet_stream_base bool packet_valid(Packet_descriptor packet) { - return (packet.offset() >= _bulk_buffer_offset + return !packet.size() || (packet.offset() >= _bulk_buffer_offset && packet.offset() < _bulk_buffer_offset + (Genode::off_t)_bulk_buffer_size && packet.offset() + packet.size() <= _bulk_buffer_offset + _bulk_buffer_size); }