Skip to content

Conversation

@bluhm
Copy link

@bluhm bluhm commented Sep 12, 2025

Due do compiling json with -Werrro, g++ (Debian 14.2.0-19) 14.2.0 fails with "warning: '(Json::Value::ValueHolder)this' is used uninitialized". The default constructor uses nullValue to initialize the Value without a value. When calling method swapPayload() with such an object, the uninitialized internal value gets accessed. As a simple workaround set new Value objects to integer 0.

Due do compiling json with -Werrro, g++ (Debian 14.2.0-19) 14.2.0
fails with "warning: '*(Json::Value::ValueHolder*)this' is used
uninitialized".  The default constructor uses nullValue to initialize
the Value without a value.  When calling method swapPayload() with
such an object, the uninitialized internal value gets accessed.  As
a simple workaround set new Value objects to integer 0.

Signed-off-by: Alexander Bluhm <[email protected]>
case tokenNull:
{
Value v;
Value v(0);
Copy link

@emmanuel-deloget emmanuel-deloget Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Value exists with a default ctor (one that takes nullValue by default) this is not, IMHO, the right change. The default ctor shall be changed so that it correctly initialize all the Value properties when called (this is not done if it's called without any parameter or if it's called with vtype = nullValue).

The same goes for the other occurences of the same change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants