Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

jmjatlanta
Copy link

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.

: 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)
Copy link
Collaborator

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)
Copy link
Collaborator

@dimxy dimxy Aug 10, 2022

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)

@dimxy
Copy link
Collaborator

dimxy commented Aug 10, 2022

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.
However there is a newer PR #548 from Jun 2022 which changes the same code, but it does not have those calls to the events default constructors.
Wondering, was it supposed for 548 that this PR had been already merged or maybe this one is not actual?

@tonymorony
Copy link

these changes implemented in combined PR: #559

@tonymorony tonymorony closed this Sep 5, 2022
Alrighttt pushed a commit to Alrighttt/komodo that referenced this pull request May 30, 2023
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.

3 participants