Skip to content

Commit 17f25a1

Browse files
authored
Bugfix: packet buffer counter going negative and triggering UBSan Issue (project-chip#35708)
* Fix for issue where the packet buffer counter (sResourcesInUse[kSystemLayer_NumPacketBufs]) in SystemStats is going negative and underflowing, triggering a UBSan issue during fuzzing * Integrating comments
1 parent a99bb07 commit 17f25a1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/system/SystemPacketBuffer.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ void PacketBufferHandle::InternalRightSize()
151151
return;
152152
}
153153

154+
SYSTEM_STATS_INCREMENT(chip::System::Stats::kSystemLayer_NumPacketBufs);
155+
154156
uint8_t * const newStart = newBuffer->ReserveStart();
155157
newBuffer->next = nullptr;
156158
newBuffer->payload = newStart + (payload - start);

0 commit comments

Comments
 (0)