From 8e6bc37785ea8f7d01fecca86299a9077bd6b378 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 19 Mar 2026 13:41:04 -1000 Subject: [PATCH] Ensure non-zero seed after random_bytes() --- esphome/core/helpers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index 1b6f8caf717..ee99c541963 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -172,6 +172,7 @@ uint32_t random_uint32() { // a separate bool flag (4 bytes BSS + branch on every call). if (splitmix32_state == 0) { random_bytes(reinterpret_cast(&splitmix32_state), sizeof(splitmix32_state)); + splitmix32_state |= 1; // ensure non-zero seed } splitmix32_state += 0x9e3779b9u; uint32_t z = splitmix32_state;