From 4ce70d4a35f1618f40747028bb91f668e143f989 Mon Sep 17 00:00:00 2001 From: Jeff Tung <100387939+jtung-apple@users.noreply.github.com> Date: Wed, 24 Aug 2022 08:35:16 -0700 Subject: [PATCH] use numeric_limits to avoid problems with underlying type change --- src/system/SystemPacketBuffer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system/SystemPacketBuffer.cpp b/src/system/SystemPacketBuffer.cpp index b171f072a63a46..c4904a8c968f5c 100644 --- a/src/system/SystemPacketBuffer.cpp +++ b/src/system/SystemPacketBuffer.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #if CHIP_SYSTEM_CONFIG_USE_LWIP #include @@ -431,7 +432,7 @@ void PacketBuffer::AddRef() pbuf_ref(this); #else // !CHIP_SYSTEM_CONFIG_USE_LWIP LOCK_BUF_POOL(); - VerifyOrDieWithMsg(this->ref < UINT16_MAX, chipSystemLayer, "packet buffer refcount overflow"); + VerifyOrDieWithMsg(this->ref < std::numeric_limitsref)>::max(), chipSystemLayer, "packet buffer refcount overflow"); ++this->ref; UNLOCK_BUF_POOL(); #endif // !CHIP_SYSTEM_CONFIG_USE_LWIP