From 1a588a9e0748b0f912867972736e6764981fd5b3 Mon Sep 17 00:00:00 2001 From: Neil Abcouwer Date: Tue, 13 Jul 2021 17:13:54 -0700 Subject: [PATCH] In FprimeProtocol.cpp:deframe(), make buffer no larger than requested (as is possible with static memory allocator) --- Svc/FramingProtocol/FprimeProtocol.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Svc/FramingProtocol/FprimeProtocol.cpp b/Svc/FramingProtocol/FprimeProtocol.cpp index 489be1c598..95d29c4278 100644 --- a/Svc/FramingProtocol/FprimeProtocol.cpp +++ b/Svc/FramingProtocol/FprimeProtocol.cpp @@ -109,6 +109,10 @@ DeframingProtocol::DeframingStatus FprimeDeframing::deframe(Types::CircularBuffe return DeframingProtocol::DEFRAMING_INVALID_CHECKSUM; } Fw::Buffer buffer = m_interface->allocate(size); + // some allocators may return buffers larger than requested + // that causes issues in routing. adjust size + FW_ASSERT(buffer.getSize() >= size); + buffer.setSize(size); ring.peek(buffer.getData(), size, FP_FRAME_HEADER_SIZE); m_interface->route(buffer); return DeframingProtocol::DEFRAMING_STATUS_SUCCESS;