Bug #3249
Updated by Junxiao Shi about 9 years ago
`ndn::lp::Packet` throws exceptions of type `std::out_of_range` and `std::length_error` `std::length_error`. My recollection is that we must use only `ndn::tlv::Error` (or subclasses of it) as the exception type in packet parsing code, so that one `catch` statement is sufficient in most cases. As a matter of fact, there is even an `Error` class nested in `lp::Packet` that derives from `ndn::tlv::Error`, however it is never used. So I suppose these throws should be changed to indicate logic errors. However, use `Error`. Alternatively, if this really was by design, then the bug is in NFD's `GenericLinkService::doReceivePacket()` `GenericLinkService::doReceivePacket()`, which performs insufficient validation before calling `get<lp::FragmentField>()`, which may cause NFD to crash when receiving malformed packets. `get<lp::FragmentField>()`.