Add debug assert for uint16_t overflow in callback_manager_grow

This commit is contained in:
J. Nick Koston
2026-03-27 15:53:47 -10:00
parent 1bdf6402a2
commit fe8e7c134c
+1
View File
@@ -24,6 +24,7 @@ static const char *const TAG = "helpers";
__attribute__((noinline, cold)) void *callback_manager_grow(void *data, uint16_t size, uint16_t &capacity,
size_t elem_size) {
ESPHOME_DEBUG_ASSERT(size < UINT16_MAX);
uint16_t new_cap = size + 1;
auto *new_data = ::operator new(new_cap *elem_size);
if (data) {