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

Prevent crashes when calling methods on invalid Usd.SchemaBase objects #876

Conversation

marktucker
Copy link
Contributor

In wrapSchemaBase, replace the getattribute method as was already being
done in wrapObject. This overloaded getattribute actually allows any of
the UsdSchemaBase APIs to be called (as all of the methods at this level can
still return useful information). But its purpose is to block calls to APIs
defined on subclasses.

Provided similar protection for UsdGeomPrimvar, which is an odd case that is
like a schema class, but operates on a single attribute and so is not derived
from SchemaBase.

Added some test cases, including an explicit test of issue #872, a crash when
calling UsdGeom.Xformable().ClearXformOpOrder(). TestUsdRiSplineAPI had to be
updated because a test in there was not expecting the RuntimeException from
an invalid object.

Fixes Issue(s)

… being

done in wrapObject. This overloaded __getattribute__ actually allows any of
the UsdSchemaBase APIs to be called (as all of the methods at this level can
still return useful information). But its purpose is to block calls to APIs
defined on subclasses.

Provided similar protection for UsdGeomPrimvar, which is an odd case that is
like a schema class, but operates on a single attribute and so is not derived
from SchemaBase.

Added some test cases, including an explicit test of issue PixarAnimationStudios#872, a crash when
calling UsdGeom.Xformable().ClearXformOpOrder(). TestUsdRiSplineAPI had to be
updated because a test in there was not expecting the RuntimeException from
an invalid object.
…ribute

is not. More thorough testing of these whitelisted methods.

Add a few more SchemaBase tests, including the construction of a CollectionAPI
object from an invalid SchemaBase object. The result is an invalid CollectionAPI
object.
@marktucker
Copy link
Contributor Author

Thanks for the feedback, @spiffmon. Addressing this first round of comments with an additional commit.

@jilliene
Copy link

Filed as internal issue #USD-5380

@pixar-oss pixar-oss merged commit 9062ad8 into PixarAnimationStudios:dev Jul 17, 2019
pixar-oss added a commit that referenced this pull request Jul 17, 2019
Prevent crashes when calling methods on invalid Usd.SchemaBase objects

(Internal change: 1987218)
@marktucker marktucker deleted the dev_protect_schemabase_wrappers branch April 9, 2020 02:23
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.

6 participants