msgbuf: Bounds checks that satisfy GCC's analyzer
The intent is that there is no change in behavior, but that the code
patterns better match the analyzer's expectations.
Change-Id: I58544aaf6b15209e754059bf72a55dc9d63c9d61
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/tests/dsp/platform.cpp b/tests/dsp/platform.cpp
index a81319b..2d29445 100644
--- a/tests/dsp/platform.cpp
+++ b/tests/dsp/platform.cpp
@@ -3706,6 +3706,7 @@
uint8_t rettransportProtocolType;
uint8_t reteventReceiverAddressInfo;
uint16_t retheartbeatTimer;
+
rc = decode_set_event_receiver_req(
request, requestMsg.size() - hdrSize - 1, &reteventMessageGlobalEnable,
&rettransportProtocolType, &reteventReceiverAddressInfo,
@@ -5733,20 +5734,11 @@
cperEventSize);
EXPECT_EQ(rc, -EINVAL);
-#ifdef NDEBUG
rc = decode_pldm_platform_cper_event(
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<uint8_t*>(eventData.data()), eventData.size() - 1,
cperEvent, cperEventSize);
EXPECT_EQ(rc, -EOVERFLOW);
-#else
- EXPECT_DEATH(
- decode_pldm_platform_cper_event(
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
- reinterpret_cast<uint8_t*>(eventData.data()), eventData.size() - 1,
- cperEvent, cperEventSize),
- "ctx->remaining >= 0");
-#endif
rc = decode_pldm_platform_cper_event(
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)