From 6cda03c5d6c06d8c03c5901cad06cea97de6a647 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 18 Jul 2024 08:55:08 +0200 Subject: [PATCH] QPROPERTY_TEST_COMPARISON_HELPER: don't write 1KiB of NULs qsnprint() is unconditionally called to fill the buffer and is guaranteed to NUL-terminate, so there's no point in filling the whole 1KiB stack buffer with NULs beforehand. Leave it uninitialized. Amends 930e59b798d9e3d08e17440980d33a08fb411cbe. Pick-to: 6.7 6.5 6.2 Change-Id: I7da859d609ad4492c9038cb3e14f2a721b2acbe4 Reviewed-by: Ivan Solovev (cherry picked from commit 47c2263e896408e733c9aa466aec388cc4b4a6ad) Reviewed-by: Qt Cherry-pick Bot --- src/testlib/qpropertytesthelper_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testlib/qpropertytesthelper_p.h b/src/testlib/qpropertytesthelper_p.h index c691802a390..226de8e3fba 100644 --- a/src/testlib/qpropertytesthelper_p.h +++ b/src/testlib/qpropertytesthelper_p.h @@ -45,7 +45,7 @@ namespace QTestPrivate { #define QPROPERTY_TEST_COMPARISON_HELPER(actual, expected, comparator, represent) \ do { \ const size_t maxMsgLen = 1024; \ - char msg[maxMsgLen] = { '\0' }; \ + char msg[maxMsgLen]; \ auto actualStr = represent(actual); \ auto expectedStr = represent(expected); \ const size_t len1 = mbstowcs(nullptr, #actual, maxMsgLen); \