From b4d3a279e3198257cc40c0338dcf1bae216790c8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 19:05:32 +0000 Subject: [PATCH] Fix potential overflow in PSRAM size calculation - Changed division from (1024 * 1024) to (1024UL * 1024UL) - Ensures proper unsigned long type to prevent overflow issues - All tests pass and firmware builds successfully Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com> --- _codeql_detected_source_root | 1 + wled00/json.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 120000 _codeql_detected_source_root diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/wled00/json.cpp b/wled00/json.cpp index bbb8c0c7..7404a202 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -847,7 +847,7 @@ void serializeInfo(JsonObject root) #if defined(BOARD_HAS_PSRAM) root[F("psram")] = ESP.getFreePsram(); // Free PSRAM in bytes (backward compatibility) #endif - root[F("psramSize")] = ESP.getPsramSize() / (1024 * 1024); // Total PSRAM size in MB + root[F("psramSize")] = ESP.getPsramSize() / (1024UL * 1024UL); // Total PSRAM size in MB } #endif root[F("uptime")] = millis()/1000 + rolloverMillis*4294967;