[Mac] VTVideoDecoderClass object pointers can become unaligned on x86
<rdar://92445366>
Created attachment 458617 [details] Patch
Comment on attachment 458617 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=458617&action=review > Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp:61 > +struct DecoderBaseClass { > uint8_t pad[padSize]; > CMBaseClass alignedClass; > }; Can we put this in WebKitDecoder.h so it can be shared by the decoders? > Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp:86 > +static_assert(offsetof(DecoderBaseClass, alignedClass) == padSize, "CMBaseClass offset is incorrect!"); > +static_assert(alignof(DecoderBaseClass) == 4, "CMBaseClass must have 4 byte alignment"); Ditto > Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp:95 > +#pragma pack(push, 4) > +struct DecoderClass { > + uint8_t pad[padSize]; > + VTVideoDecoderClass alignedClass; > +}; Ditto > Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp:122 > +static_assert(offsetof(DecoderClass, alignedClass) == padSize, "CMBaseClass offset is incorrect!"); > +static_assert(alignof(DecoderClass) == 4, "CMBaseClass must have 4 byte alignment"); Ditto
(In reply to Eric Carlson from comment #3) > Comment on attachment 458617 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=458617&action=review > > > Source/ThirdParty/libwebrtc/Source/webrtc/sdk/WebKit/WebKitVP8Decoder.cpp:61 > > +struct DecoderBaseClass { > > uint8_t pad[padSize]; > > CMBaseClass alignedClass; > > }; > > Can we put this in WebKitDecoder.h so it can be shared by the decoders? We'd have to expose CMBaseClass in those headers as well, and that header is used outside of just the VP8 and VP9 implementations.
Comment on attachment 458617 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=458617&action=review > Source/ThirdParty/libwebrtc/ChangeLog:11 > + dereferencing that pointer will fail. I know that this is a performance issue, but I don't think that it ever fails on Intel? Perhaps there is some software limitation between WebKit and the CPU though.
Committed r293643 (250147@main): <https://commits.webkit.org/250147@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 458617 [details].