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

Detect if USD was built with extra security patches #2945

Merged
merged 2 commits into from
Mar 16, 2023

Conversation

seando-adsk
Copy link
Collaborator

Detect if USD was built with extra security patches and set mod file variable MAYA_USD_VERSION accordingly.

and set mod file variable MAYA_USD_VERSION accordingly.
@seando-adsk seando-adsk added the adsk Related to Autodesk plugin label Mar 15, 2023
@seando-adsk seando-adsk requested a review from neilh-adsk March 15, 2023 19:05
Comment on lines +69 to +82
# Set special Autodesk USD version. We use this to communicate whether or not
# there are extra patches on-top of the normal USD build.
set(ADSK_USD_VERSION ${USD_VERSION})
if (USD_VERSION VERSION_LESS_EQUAL "0.23.02")
# In the security fix there was a new inline method "max_size" added so we
# can use that to determine if this USD build has the security fix.
if (USD_INCLUDE_DIR AND EXISTS "${USD_INCLUDE_DIR}/pxr/base/vt/array.h")
file(STRINGS ${USD_INCLUDE_DIR}/pxr/base/vt/array.h USD_HAS_SECURITY_PATCH REGEX "constexpr size_t max_size\(\)")
if (USD_HAS_SECURITY_PATCH)
set(ADSK_USD_VERSION "${ADSK_USD_VERSION}-ad1")
message(STATUS "USD v${USD_VERSION} has security patches.")
endif()
endif()
endif()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added new cmake variable "ADSK_USD_VERSION" which starts out equal to normal "USD_VERSION". Detect in an automatic way if the USD build (any version <= 0.23.02) has the extra security patches. Do this by looking at the vt/array.h header file for a new method which was added in one of the patches. If so then add "-ad1" to new variable ADSK_USD_VERSION.

@@ -233,7 +233,7 @@ void registerVersionedPlugins()
static std::once_flag once;
std::call_once(once, []() {
const std::string pythonVersion = TOSTRING(MAYA_PY_VERSION);
const std::string usdVersion = TOSTRING(MAYA_USD_VERSION);
const std::string usdVersion = TOSTRING(ADSK_USD_VERSION);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Use the new adsk usd version here which may contain "-ad1".

@@ -6,7 +6,7 @@ scripts:
resources:
PYTHONPATH+:=lib/python
USD_LOCATION:=
MAYA_USD_VERSION=${USD_VERSION}
MAYA_USD_VERSION=${ADSK_USD_VERSION}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the mod file set MAYA_USD_VERSION to new ADSK_USD_VERSION.

neilh-adsk
neilh-adsk previously approved these changes Mar 15, 2023
@seando-adsk seando-adsk requested a review from neilh-adsk March 16, 2023 12:47
@seando-adsk seando-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Mar 16, 2023
@seando-adsk seando-adsk merged commit 88e6cae into dev Mar 16, 2023
@seando-adsk seando-adsk deleted the donnels/detect_usd_security_patched_build branch March 16, 2023 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants