• Eric Pouech's avatar
    avifil32: Fix GCC 12.2 warning (-Warray-bounds). · 52a83ffe
    Eric Pouech authored
    Since struct _IAVIStreamImpl has a pointer to a WAVEFORMATEX,
    GCC 12.2 emits warning when dereferencing that pointer when
    the block has been allocated with sizeof(PCMWAVEFORMAT).
    
    The warning is fixed by always allocating with sizeof(WAVEFORMATEX).
    This will overallocate in case of a PCM stream.
    
    The alternative would have been to store in struct _IAVIStreamImpl
    a pointer to PCMWAVEFORMAT instead, and add the casting to a
    WAVEFORMATEX when needed. That would clutter the code IMO since most
    of the ACM APIs expect a LPWAVEFORMATEX.
    
    /home/eric/work/wine/dlls/avifil32/acmstream.c: In function 'AVIFILE_OpenCompressor':
    /home/eric/work/wine/dlls/avifil32/acmstream.c:105:24: warning: array subscript 'struct tWAVEFORMATEX[0]' is partly outside array bounds of 'unsigned char[16]' [-Warray-bounds]
      105 |       This->lpOutFormat->wFormatTag = WAVE_FORMAT_PCM;
          |                        ^~
    /home/eric/work/wine/dlls/avifil32/acmstream.c:101:27: note: object of size 16 allocated by 'HeapAlloc'
      101 |       This->lpOutFormat = HeapAlloc(GetProcessHeap(), 0, This->cbOutFormat);
          |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Signed-off-by: 's avatarEric Pouech <eric.pouech@gmail.com>
    52a83ffe
Name
Last commit
Last update
..
tests Loading commit data...
Makefile.in Loading commit data...
acmstream.c Loading commit data...
api.c Loading commit data...
avifil32.idl Loading commit data...
avifil32.rc Loading commit data...
avifil32.spec Loading commit data...
avifile.c Loading commit data...
avifile.rgs Loading commit data...
avifile_private.h Loading commit data...
editstream.c Loading commit data...
extrachunk.c Loading commit data...
extrachunk.h Loading commit data...
factory.c Loading commit data...
getframe.c Loading commit data...
icmstream.c Loading commit data...
tmpfile.c Loading commit data...
wavfile.c Loading commit data...