-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly initialize event_pubkeys #510
Conversation
: event(EVENT_NOTARIZED, height), MoMdepth(0) | ||
event_notarized::event_notarized(uint8_t *data, long &pos, long data_len, int32_t height, | ||
const char* _dest, bool includeMoM) | ||
: event_notarized(height, dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems 'dest' is not initialised yet (maybe _dest was supposed)
@@ -188,10 +187,8 @@ event_notarized::event_notarized(uint8_t *data, long &pos, long data_len, int32_ | |||
} | |||
|
|||
event_notarized::event_notarized(FILE* fp, int32_t height, const char* _dest, bool includeMoM) | |||
: event(EVENT_NOTARIZED, height), MoMdepth(0) | |||
: event_notarized(height, dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here: it seems 'dest' is not initialised yet
(interesting that my g++ version does not show this as 'warning: field is uninitialized when used here'. It would show this warning only if I made this 'dest' field as int)
I have got a question about this PR: its idea to call default constructors for event objects. This PR was created in Oct 2021 and is still waiting. |
these changes implemented in combined PR: #559 |
The intent was to call the default constructor for zero initialization. But it was not followed in all implementations of the constructor event_pubkeys. This leads to some instances where uninitialized data could be in the structure. This can lead to problems with serialization.
This fix calls the default constructor regardless of the constructor chosen.