Reject non-finite/non-positive input across the module
PhysX's own PX_CHECK_AND_RETURN(...isFinite()/isSane()...) and
PxGeometry::isValid() checks are compiled out unless PX_CHECKED is
defined, which this project only does in Debug builds, so in Release,
unvalidated QML-facing input reaches native PhysX calls completely
unguarded. Adds finiteness/positivity checks at every affected setter,
invokable, and per-frame sync point:
- DynamicRigidBody: mass, inertiaTensor, kinematicPosition/Rotation/
EulerRotation/Pivot, centerOfMassPosition/Rotation, and the velocity/
force/impulse/reset invokables. inertiaMatrix's diagonalization check
used "<= 0", which NaN always compares false to; now also checks
isFinite() explicitly.
- PhysicsWorld: gravity, minimumTimestep/maximumTimestep, typicalLength/
typicalSpeed, defaultDensity (a second, independent entry point into
the same command as DynamicRigidBody.setDensity()).
- PhysicsMaterial's clamp() had the same NaN blind spot; reordered to
be NaN-safe.
- HeightFieldShape.extents: unvalidated row/column/height scale factors
reached PxHeightFieldGeometry construction.
- SphereShape/CapsuleShape/BoxShape dimensions, both at their own
setters and again after being multiplied by the ancestor node
chain's sceneScale() (unvalidated) to build the actual PxGeometry;
the character controller's per-frame capsule resize has the same
sceneScale() gap through a separate code path. MeshShape's scaled
PxMeshScale likewise re-checked (PxVec3::minElement()/maxElement()
can resolve a lone NaN component instead of propagating it, so
isValidFor*Mesh() alone isn't enough).
- CharacterController.movement/gravity/teleport(): PhysX's character-
kinematic code has no finiteness guard at all, checked build or not.
- PhysicsNode position/rotation at actor creation and, for static
bodies, every synced frame (fuzzyEquals(Infinity, Infinity) is false,
so a stuck-at-Infinity pose couldn't even be skipped by the "only
sync if moved" check); a collision shape's own local position/
rotation before setLocalPose(); TriggerBody's per-frame sync; and a
DynamicRigidBody kinematic target's ancestor-composed transform,
which the leaf kinematicPosition/kinematicRotation setters don't
cover on their own.
- PhysicsJoint.positionA/positionB/orientationA/orientationB, shared by
every joint subtype via QPhysicsJoint::updatePhysXBackend().
Adds a shared QPhysicsUtils::isFinite(QVector3D/QQuaternion/PxVec3)
instead of reimplementing it per file, and regression cases to
tests/auto/invalidinput.
Pick-to: 6.12 6.11 6.8
Change-Id: Ib0c166c555713aa4478f810d35dae28a1a15ba9b
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>