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

Make GenericSchemaDocument constructor explicit #674

Merged
merged 1 commit into from
Jul 2, 2016

Conversation

sjasonsmith
Copy link
Contributor

Prior to this change, a user could incorrectly pass a Document object to
SchemaValidator. This would implicitly construct a SchemaDocument, which
would then be destructed before the validator was used. This caused
unpredictable results including memory corruption and program crashes.

Consider the following snippet, which compiles cleanly but does not behave as expected, because the wrong variable was passed to the SchemaValidator constructor:

    Document sd;
    sd.Parse("{}");
    SchemaDocument schema(sd);
    SchemaValidator validator(sd);

    Document testDoc;
    testDoc.Parse("10");
    testDoc.Accept(validator);

Prior to this change, a user could incorrectly pass a Document object to
SchemaValidator. This would implicitly construct a SchemaDocument, which
would then be destructed before the validator was used. This caused
unpredictable results including memory corruption and program crashes.
@coveralls
Copy link

coveralls commented Jul 1, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling 8991561 on sjasonsmith:master into 727e2b9 on miloyip:master.

@miloyip miloyip merged commit 5e8a382 into Tencent:master Jul 2, 2016
@miloyip
Copy link
Collaborator

miloyip commented Jul 2, 2016

Thanks

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