-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#40069Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktope: embedderUsers of the Embedder APIUsers of the Embedder API
Description
Solution
- Add a comment to
FlutterRectthat new members cannot be added - Add a unit test to verify new members aren't added to
FlutterRect.
Background
The engine uses FlutterFrameBufferWithDamageCallback to notify the embedder of a damage region using an array of FlutterRect. Adding members to FlutterRect would break the ABI of this callback.
For example:
FlutterDamage damageRegion = ...;
FlutterRect first = damageRegion.damage[0];
FlutterRect second = damageRegion.damage[1]; // BAD! This could crash
The array indexing might crash if the external embedder wasn't recompiled after an engine update. Instead, external embedders must determine the size of FlutterRect using their struct_size member. Something like:
FlutterDamage damageRegion = ...;
FlutterRect first = damageRegion.damage[0];
FlutterRect second = static_cast<FlutterRect*>(
static_cast<char*>(damageRegion.damage) + 1 * first.struct_size);This problem would've been avoided if FlutterDamage.damage was an array of pointers to FlutterRect instead of arrays of FlutterRect.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktope: embedderUsers of the Embedder APIUsers of the Embedder API