-
Notifications
You must be signed in to change notification settings - Fork 261
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
Validation layer: null pointer deref when struct contains handle #161
Comments
Thanks. Do you have a test program? |
No, this was found via static analysis with clang/CodeChecker. |
I think I see. In
There's a check that I'll put this in my queue. (In the event that |
No, I don't think that's quite right. So this addition to hello_xr causes a warning from the validation layer ("XR_ERROR_VALIDATION_FAILURE in xrSyncActions: (syncInfo->countActiveActionSets == 0)"), but it doesn't error. (Is that intended?) diff --git a/src/tests/hello_xr/openxr_program.cpp b/src/tests/hello_xr/openxr_program.cpp
index 4e8976d..c2ae201 100644
--- a/src/tests/hello_xr/openxr_program.cpp
+++ b/src/tests/hello_xr/openxr_program.cpp
@@ -554,6 +554,11 @@ struct OpenXrProgram : IOpenXrProgram {
InitializeActions();
CreateVisualizedSpaces();
+ XrActionsSyncInfo info{XR_TYPE_ACTIONS_SYNC_INFO, nullptr};
+ info.activeActionSets = nullptr;
+ info.countActiveActionSets = 0;
+ xrSyncActions(m_session, &info);
+
{
XrReferenceSpaceCreateInfo referenceSpaceCreateInfo = GetXrReferenceSpaceCreateInfo(m_options->AppSpace);
CHECK_XRCMD(xrCreateReferenceSpace(m_session, &referenceSpaceCreateInfo, &m_appSpace)); while this change will trigger the bad behavior of this bug: diff --git a/src/tests/hello_xr/openxr_program.cpp b/src/tests/hello_xr/openxr_program.cpp
index 4e8976d..504a975 100644
--- a/src/tests/hello_xr/openxr_program.cpp
+++ b/src/tests/hello_xr/openxr_program.cpp
@@ -554,6 +554,11 @@ struct OpenXrProgram : IOpenXrProgram {
InitializeActions();
CreateVisualizedSpaces();
+ XrActionsSyncInfo info{XR_TYPE_ACTIONS_SYNC_INFO, nullptr};
+ info.activeActionSets = nullptr;
+ info.countActiveActionSets = 5; // this is a lie
+ xrSyncActions(m_session, &info);
+
{
XrReferenceSpaceCreateInfo referenceSpaceCreateInfo = GetXrReferenceSpaceCreateInfo(m_options->AppSpace);
CHECK_XRCMD(xrCreateReferenceSpace(m_session, &referenceSpaceCreateInfo, &m_appSpace)); resulting in
|
In what way is it "not quite right"? If I apply your second patch (
like I said it would. Does that not print out for you? Then I get a crash, like the static check implies. That's because the pointer is checked but then the code continues on because xr_result is set and then never examined. If I add I think we need, like #160, to figure out whether to check (The behavior from the layer on |
I don't think I got that message (or any message?) but perhaps I didn't have the layer configured right. As long as you see what's happening with the second patch, then we're good - that's much clearer than my prose from last week. |
I did have to set the environment variable for logging to stdout. I think (grepping for "Env", not in front of my running build at the moment) it's |
Yeah, that or a readme. Any reason why logging to stdout isn't default? |
An issue (number 1322) has been filed to correspond to this issue in the internal Khronos GitLab. If you have a Khronos account, you can access that issue at KHR:openxr/openxr#1322. |
fwiw, if checking gets moved up, I'd prefer to convert the use of a pointer to a reference: lacking use of |
It turns out there is a readme already. I didn't know it was there either. |
- Registry - Add an author ID, and reserve a vendor extension for Huawei. (OpenXR-Docs/#46) - Reserve vendor extensions for future LunarG overlay and input focus functionality. (internal MR 1720) - Reserve vendor extensions for Microsoft. (internal MR 1723) - Add XR_EXT_hand_tracking multi-vendor extension. (internal MR 1554, internal issue 1266, internal issue 1267, internal issue 1268, internal issue 1269) - Add XR_HUAWEI_controller_interaction vendor extension. (OpenXR-Docs/#47) - Add XR_MNDX_egl_enable provisional vendor extension. (OpenXR-Docs/#48) - Add XR_MSFT_spatial_graph_bridge vendor extension. (internal MR 1730) - Add XR_MSFT_secondary_view_configuration and XR_MSFT_first_person_observer vendor extensions. (internal MR 1731) - Add XR_MSFT_hand_mesh_tracking vendor extension. (internal MR 1736) - Fix missing space in XML definition of XrSpatialAnchorCreateInfoMSFT. (internal MR 1742, internal issue 1351, OpenXR-SDK-Source/#187) - Update a number of contacts for author/vendor tags. (internal MR 1788, internal issue 1326) - SDK - Replaced usage of the _DEBUG macro with NDEBUG. (internal MR 1756) - Allow disabling of std::filesystem usage via CMake, and detect if it’s available and what its requirements are. (OpenXR-SDK-Source/#192, OpenXR-SDK-Source/#188) - CI: Modifications to Azure DevOps build pipeline. Now builds UWP loader DLLs in addition to Win32 loader DLLs. No longer builds static loader libraries due to linkability concerns. Re-arranged release artifact zip to distinguish architecture from 32-bit or 64-bit. - Loader: Replace global static initializers with functions that return static locals. With this change, code that includes OpenXR doesn’t have to page in this code and initialize these during startup. (OpenXR-SDK-Source/#173) - Loader: Unload runtime when xrCreateInstance fails. (internal MR 1778) - Loader: Add “info”-level debug messages listing all the places that we look for the OpenXR active runtime manifest. (OpenXR-SDK-Source/#190) - Validation Layer: Fix crash in dereferencing a nullptr optional array handle when the count > 0. (internal MR 1709, OpenXR-SDK-Source/#161, internal issue 1322) - Validation Layer: Fix static analysis error and possible loss of validation error. (internal MR 1715, OpenXR-SDK-Source/#160, internal issue 1321) - Validation Layer: Simplify some generated code, and minor performance improvements. (OpenXR-SDK-Source/#176) - API Dump Layer: Fix crash in dereferencing a nullptr while constructing a std::string. (internal MR 1712, OpenXR-SDK-Source/#162, internal issue 1323) - hello_xr: Fix releasing a swapchain image with the incorrect image layout. (internal MR 1755) - hello_xr: Prefer VK_LAYER_KHRONOS_validation over VK_LAYER_LUNARG_standard_validation when available. (internal MR 1755) - hello_xr: Optimizations to D3D12 plugin to avoid GPU pipeline stall. (internal MR 1770) (OpenXR-SDK-Source/#175) - hello_xr: Fix build with Vulkan headers 1.2.136. (OpenXR-SDK-Source/#181, OpenXR-SDK-Source/#180, internal issue 1347) - hello_xr: Fix build with Visual Studio 16.6. (OpenXR-SDK-Source/#186, OpenXR-SDK-Source/#184)
Fix released in 1.0.9 |
- Registry - Add an author ID, and reserve a vendor extension for Huawei. (OpenXR-Docs/KhronosGroup#46) - Reserve vendor extensions for future LunarG overlay and input focus functionality. (internal MR 1720) - Reserve vendor extensions for Microsoft. (internal MR 1723) - Add XR_EXT_hand_tracking multi-vendor extension. (internal MR 1554, internal issue 1266, internal issue 1267, internal issue 1268, internal issue 1269) - Add XR_HUAWEI_controller_interaction vendor extension. (OpenXR-Docs/KhronosGroup#47) - Add XR_MNDX_egl_enable provisional vendor extension. (OpenXR-Docs/KhronosGroup#48) - Add XR_MSFT_spatial_graph_bridge vendor extension. (internal MR 1730) - Add XR_MSFT_secondary_view_configuration and XR_MSFT_first_person_observer vendor extensions. (internal MR 1731) - Add XR_MSFT_hand_mesh_tracking vendor extension. (internal MR 1736) - Fix missing space in XML definition of XrSpatialAnchorCreateInfoMSFT. (internal MR 1742, internal issue 1351, OpenXR-SDK-Source/KhronosGroup#187) - Update a number of contacts for author/vendor tags. (internal MR 1788, internal issue 1326) - SDK - Replaced usage of the _DEBUG macro with NDEBUG. (internal MR 1756) - Allow disabling of std::filesystem usage via CMake, and detect if it’s available and what its requirements are. (OpenXR-SDK-Source/KhronosGroup#192, OpenXR-SDK-Source/KhronosGroup#188) - CI: Modifications to Azure DevOps build pipeline. Now builds UWP loader DLLs in addition to Win32 loader DLLs. No longer builds static loader libraries due to linkability concerns. Re-arranged release artifact zip to distinguish architecture from 32-bit or 64-bit. - Loader: Replace global static initializers with functions that return static locals. With this change, code that includes OpenXR doesn’t have to page in this code and initialize these during startup. (OpenXR-SDK-Source/KhronosGroup#173) - Loader: Unload runtime when xrCreateInstance fails. (internal MR 1778) - Loader: Add “info”-level debug messages listing all the places that we look for the OpenXR active runtime manifest. (OpenXR-SDK-Source/KhronosGroup#190) - Validation Layer: Fix crash in dereferencing a nullptr optional array handle when the count > 0. (internal MR 1709, OpenXR-SDK-Source/KhronosGroup#161, internal issue 1322) - Validation Layer: Fix static analysis error and possible loss of validation error. (internal MR 1715, OpenXR-SDK-Source/KhronosGroup#160, internal issue 1321) - Validation Layer: Simplify some generated code, and minor performance improvements. (OpenXR-SDK-Source/KhronosGroup#176) - API Dump Layer: Fix crash in dereferencing a nullptr while constructing a std::string. (internal MR 1712, OpenXR-SDK-Source/KhronosGroup#162, internal issue 1323) - hello_xr: Fix releasing a swapchain image with the incorrect image layout. (internal MR 1755) - hello_xr: Prefer VK_LAYER_KHRONOS_validation over VK_LAYER_LUNARG_standard_validation when available. (internal MR 1755) - hello_xr: Optimizations to D3D12 plugin to avoid GPU pipeline stall. (internal MR 1770) (OpenXR-SDK-Source/KhronosGroup#175) - hello_xr: Fix build with Vulkan headers 1.2.136. (OpenXR-SDK-Source/KhronosGroup#181, OpenXR-SDK-Source/KhronosGroup#180, internal issue 1347) - hello_xr: Fix build with Visual Studio 16.6. (OpenXR-SDK-Source/KhronosGroup#186, OpenXR-SDK-Source/KhronosGroup#184)
In the generated code below, there is no check for non-null value before performing
value->actionSet
The text was updated successfully, but these errors were encountered: