FIX: ISXB-1637 Crash on memcpy when calling Press() in an InputTestFixture #2254
+172
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses user reported issue: https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1637 in the following ways:
DeltaStateEvent.cs
where pointer arithmetic would be incorrect and lead to exception or crash when offsetting a nullptr.InputTestFixture.cs
(via new internal propertyInputControl.hasState
) where accessing a device from "outside" test context would lead to the same symptoms as above. This is now instead checked and throws exception if this is attempted.InputTestFixtureTests
that verifies normal behavior inInputTestFixture
as well as inappropriate use similar to the reported repro project.The problem in the provided repro project is two-fold:
[OneTimeSetup]
and[OneTimeTearDown]
to manage test devices. This will not work as intended since the device will be added to the real Input System context, then removed as part ofInputTestFixture.Setup()
. To reduce chance of similar accidental situations, I have added information recommending against this toInputTestFixture
xmldoc. In addition, if this is attempted it should result in exception which is verified in the added tests.InputTestFixture
in edit-mode tests[UnityTest]
which isn't fully supported it seems.Open issues:
UnityTest
doesn't work.Testing status & QA
Please describe the testing already done by you and what testing you request/recommend QA to execute. If you used or created any testing project please link them here too for QA.
Overall Product Risks
Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.
Comments to reviewers
Please describe any additional information such as what to focus on, or historical info for the reviewers.
Checklist
Before review:
Changed
,Fixed
,Added
sections.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: