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

DEV-3809: Fix crash of Decode function. #7

Merged
merged 3 commits into from
Aug 31, 2021

Conversation

shmuelnatan
Copy link

No description provided.


auto xml_parse_doc = xmlParseDoc(reinterpret_cast<const xmlChar *>(payload.c_str()));
if (xml_parse_doc)
std::unique_ptr<xmlDoc, XmlDocDeleter> doc(xml_parse_doc);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we just return if !xml_parse_doc?

@shmuelhazan
Copy link
Collaborator

Don't we want to somehow tell the caller about the issue?

@shmuelnatan
Copy link
Author

Do you want me to change the return value of Decode to a string or int?

@shmuelhazan
Copy link
Collaborator

Do you want me to change the return value of Decode to a string or int?

What does it currently do in a case of an error?

@shmuelnatan
Copy link
Author

Depends on the error. There are two options:

  1. throwing runtime error exception.
  2. crash (which won't happen now due to our fix).
    Otherwise, there's no indication of an error.

@shmuelhazan
Copy link
Collaborator

Depends on the error. There are two options:

  1. throwing runtime error exception.
  2. crash (which won't happen now due to our fix).
    Otherwise, there's no indication of an error.

This crash was not a runtime indication. Just a nullptr dereference.
I think that we can throw a runtime exception then.

@shmuelnatan
Copy link
Author

done

@shmuelnatan shmuelnatan merged commit 3a2dae2 into siklu-master Aug 31, 2021
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