mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Auto merge of #16816 - MortimerGoro:unsafe_layout_data_cast, r=SimonSapin
Fix unsafe casting between PersistentLayoutData and PartialPersistentLayoutData <!-- Please describe your changes on the following line: --> PersistentLayoutData and PartialPersistentLayoutData castings in Layout component assume that they have the same base raw address. This is unsafe because field orders is not guaranteed by default, and it's causing some SEGV crashes on Android indeed (https://github.com/servo/servo/issues/16647) Add a C representation to guarantee that the order of the fields and the safe casting. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #16647 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16816) <!-- Reviewable:end -->
This commit is contained in:
commit
c277beab2b
1 changed files with 1 additions and 0 deletions
|
@ -6,6 +6,7 @@ use construct::ConstructionResult;
|
|||
use script_layout_interface::PartialPersistentLayoutData;
|
||||
|
||||
/// Data that layout associates with a node.
|
||||
#[repr(C)]
|
||||
pub struct PersistentLayoutData {
|
||||
/// Data accessed by script_layout_interface. This must be first to allow
|
||||
/// casting between PersistentLayoutData and PartialPersistentLayoutData.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue