[PATCH 0/5] MR242: winegstreamer: Use wg_sample to read wg_parser data.

Zebediah Figura zfigura at codeweavers.com
Fri Jun 17 01:13:39 CDT 2022



On 6/16/22 01:58, Rémi Bernon (@rbernon) wrote:
>>> diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c
>>> index ae8a2d4d0c7..eb46982fabf 100644
>>> --- a/dlls/winegstreamer/wg_sample.c
>>> +++ b/dlls/winegstreamer/wg_sample.c
>>> @@ -47,6 +47,11 @@ struct sample
>>>    
>>>        union
>>>        {
>>> +        struct
>>> +        {
>>> +            void *__pad[3];
>>> +            BYTE buffer[];
>>> +        } raw;
>>>            struct
>>>            {
>>>                IMFSample *sample;
>>
>> Why the padding?
> 
> So that buffer is aligned to the end of the structure and so that we can
> safely use a flexible array member. Otherwise offsetof buffer[size] may
> be shorter than the struct, ending up with a undefined behavior when
> accessing a partially allocated structure and an eventual GCC warning.

Okay, that seems like a reasonable workaround; can you please add a 
comment so it's clear?



More information about the wine-devel mailing list