From 45cc5629dc6998338679386b949eab1bc9bdc06d Mon Sep 17 00:00:00 2001 From: Ricardo Garcia <47594367+rg3igalia@users.noreply.github.com> Date: Fri, 23 Oct 2026 13:18:32 +0200 Subject: [PATCH] Fix using uninitialized bytes in move constructor initBasic() never sets value_, and the move constructor calls it and later swaps with the other object. This copies uninitialized bytes into the other object, producing a warning with some GCC versions and flags. It's harmless because "other" ends up as nullValue, and nothing reads value_ for a null value: releasePayload, the comparisons and the destructor all ignore it. Apparently the warning only appears in release builds because it depends on inlining swap into the move constructor. This one-line fix makes the warning go away when compiling jsoncpp as part of VK-GL-CTS in release builds. --- src/lib_json/json_value.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index 1725f771b..5728aa1d5 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -1035,6 +1035,7 @@ const Value& Value::operator[](int index) const { void Value::initBasic(ValueType type, bool allocated) { setType(type); setIsAllocated(allocated); + value_.uint_ = 0; comments_ = Comments{}; start_ = 0; limit_ = 0;