⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276501 in webkit


Ignore:
Timestamp:
Apr 23, 2021, 9:53:23 AM (5 years ago)
Author:
Russell Epstein
Message:

Cherry-pick r276482. rdar://problem/77074513

[Mac] CMBaseClass object pointers can become unaligned on x86
https://bugs.webkit.org/show_bug.cgi?id=224950
<rdar://77020922>

Reviewed by Eric Carlson.

CMBaseClass has a 4-byte version member before its 8-byte pointers on x86. Deal with this
the same way we do with other pointer-bearing, static, CM-type objects: enforce a 4-byte
packing, and prepend the struct with another 4-byte object in order to force the pointers
into 8-byte alignment.

  • Shared/mac/MediaFormatReader/CoreMediaWrapped.h: (WebKit::CoreMediaWrapped<Wrapped>::vTable):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276482 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-611-branch/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-611-branch/Source/WebKit/ChangeLog

    r276405 r276501  
     12021-04-23  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r276482. rdar://problem/77074513
     4
     5    [Mac] CMBaseClass object pointers can become unaligned on x86
     6    https://bugs.webkit.org/show_bug.cgi?id=224950
     7    <rdar://77020922>
     8   
     9    Reviewed by Eric Carlson.
     10   
     11    CMBaseClass has a 4-byte version member before its 8-byte pointers on x86. Deal with this
     12    the same way we do with other pointer-bearing, static, CM-type objects: enforce a 4-byte
     13    packing, and prepend the struct with another 4-byte object in order to force the pointers
     14    into 8-byte alignment.
     15   
     16    * Shared/mac/MediaFormatReader/CoreMediaWrapped.h:
     17    (WebKit::CoreMediaWrapped<Wrapped>::vTable):
     18   
     19   
     20    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@276482 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     21
     22    2021-04-22  Jer Noble  <jer.noble@apple.com>
     23
     24            [Mac] CMBaseClass object pointers can become unaligned on x86
     25            https://bugs.webkit.org/show_bug.cgi?id=224950
     26            <rdar://77020922>
     27
     28            Reviewed by Eric Carlson.
     29
     30            CMBaseClass has a 4-byte version member before its 8-byte pointers on x86. Deal with this
     31            the same way we do with other pointer-bearing, static, CM-type objects: enforce a 4-byte
     32            packing, and prepend the struct with another 4-byte object in order to force the pointers
     33            into 8-byte alignment.
     34
     35            * Shared/mac/MediaFormatReader/CoreMediaWrapped.h:
     36            (WebKit::CoreMediaWrapped<Wrapped>::vTable):
     37
    1382021-04-21  Alan Coon  <alancoon@apple.com>
    239
  • branches/safari-611-branch/Source/WebKit/Shared/mac/MediaFormatReader/CoreMediaWrapped.h

    r271253 r276501  
    143143const typename CoreMediaWrapped<Wrapped>::WrapperVTable& CoreMediaWrapped<Wrapped>::vTable()
    144144{
    145     static constexpr CMBaseClass baseClass = wrapperClass<sizeof(Wrapped)>();
    146     static constexpr WrapperClass derivedClass = Wrapped::wrapperClass();
     145    // CMBaseClass contains 64-bit pointers that aren't 8-byte aligned. To suppress the linker
     146    // warning about this, we prepend 4 bytes of padding when building.
     147#if CPU(X86_64)
     148    constexpr size_t padSize = 4;
     149#else
     150    constexpr size_t padSize = 0;
     151#endif
     152
     153#pragma pack(push, 4)
     154    static constexpr struct { uint8_t pad[padSize]; CMBaseClass baseClass; } baseClass { { }, wrapperClass<sizeof(Wrapped)>() };
     155    static constexpr struct { uint8_t pad[padSize]; WrapperClass derivedClass; } derivedClass { { }, Wrapped::wrapperClass() };
     156#pragma pack(pop)
     157
    147158IGNORE_WARNINGS_BEGIN("missing-field-initializers")
    148159    static constexpr WrapperVTable vTable {
    149         { nullptr, &baseClass },
    150         &derivedClass,
     160        { nullptr, &baseClass.baseClass },
     161        &derivedClass.derivedClass,
    151162    };
    152163IGNORE_WARNINGS_END
Note: See TracChangeset for help on using the changeset viewer.