Fix UB in semantics updates (flutter/engine#29621)

Several arrays pointers on semantics update objects were being passed as
the address of the 0th element; however, this is UB in the case where
the array length is 0.

We already test for this in embedder_a11y_unittests.cc and the
associated fixture:
78a2941957/shell/platform/embedder/fixtures/main.dart (L182-L184)

We didn't catch this since we don't currently run the embedder tests on
Windows.

Issue: flutter/flutter#93338
This commit is contained in:
Chris Bracken
2021-11-09 13:03:56 -08:00
committed by GitHub
parent 9c5557e8f7
commit 1e13b1171d

View File

@@ -1052,10 +1052,10 @@ FlutterEngineResult FlutterEngineInitialize(size_t version,
node.rect.fBottom},
flutter_transform,
node.childrenInTraversalOrder.size(),
&node.childrenInTraversalOrder[0],
&node.childrenInHitTestOrder[0],
node.childrenInTraversalOrder.data(),
node.childrenInHitTestOrder.data(),
node.customAccessibilityActions.size(),
&node.customAccessibilityActions[0],
node.customAccessibilityActions.data(),
node.platformViewId,
};
ptr(&embedder_node, user_data);