mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:39:34 +00:00
avifil32: Fix GCC 12.2 warning (-Warray-bounds).
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: Eric Pouech <eric.pouech@gmail.com>
This commit is contained in:
parent
e8390a102a
commit
52a83ffe4e
|
@ -97,7 +97,7 @@ static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This)
|
|||
|
||||
if (This->lpOutFormat == NULL) {
|
||||
/* we must decode to default format */
|
||||
This->cbOutFormat = sizeof(PCMWAVEFORMAT);
|
||||
This->cbOutFormat = sizeof(WAVEFORMATEX);
|
||||
This->lpOutFormat = HeapAlloc(GetProcessHeap(), 0, This->cbOutFormat);
|
||||
if (This->lpOutFormat == NULL)
|
||||
return AVIERR_MEMORY;
|
||||
|
@ -249,7 +249,7 @@ static HRESULT WINAPI ACMStream_fnCreate(IAVIStream *iface, LPARAM lParam1,
|
|||
if (((LPWAVEFORMATEX)lParam2)->wFormatTag != WAVE_FORMAT_PCM)
|
||||
This->cbOutFormat = sizeof(WAVEFORMATEX) + ((LPWAVEFORMATEX)lParam2)->cbSize;
|
||||
else
|
||||
This->cbOutFormat = sizeof(PCMWAVEFORMAT);
|
||||
This->cbOutFormat = sizeof(WAVEFORMATEX);
|
||||
|
||||
This->lpOutFormat = HeapAlloc(GetProcessHeap(), 0, This->cbOutFormat);
|
||||
if (This->lpOutFormat == NULL)
|
||||
|
|
Loading…
Reference in a new issue