[PATCH 1/5] kernelbase: Fix incorrect pseudo console allocation size (GCC 11).
Rémi Bernon
rbernon at codeweavers.com
Mon Sep 27 03:58:29 CDT 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
GCC 11 is much more verbose with its array-bounds and stringop-overread
warnings, and they are enabled by default.
Some of these lead to some genuine fixes like the first two patches here
while some are a bit more dubious but easy to fix, like the last three
patches.
Then there's a lot more additional array-bounds warnings emitted, caused
by flexible array sizes which we define to 1 by default, in most cases.
When a variable is allocated with the array size set to 0, GCC emits a
warning each time the variable is used, as it assumes any of its members
may be accessed (although the first array member may not be accessed at
all).
A possible fix for this would be to use true C99 flexible array sizes
instead, but it then breaks a bunch of type size checks instead.
dlls/kernelbase/console.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/kernelbase/console.c b/dlls/kernelbase/console.c
index c38e8e91955..a7eeb439232 100644
--- a/dlls/kernelbase/console.c
+++ b/dlls/kernelbase/console.c
@@ -1728,7 +1728,7 @@ HRESULT WINAPI CreatePseudoConsole( COORD size, HANDLE input, HANDLE output, DWO
if (!size.X || !size.Y || !ret) return E_INVALIDARG;
- if (!(pseudo_console = HeapAlloc( GetProcessHeap(), 0, HEAP_ZERO_MEMORY ))) return E_OUTOFMEMORY;
+ if (!(pseudo_console = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pseudo_console) ))) return E_OUTOFMEMORY;
swprintf( pipe_name, ARRAY_SIZE(pipe_name), L"\\\\.\\pipe\\wine_pty_signal_pipe%x",
GetCurrentThreadId() );
--
2.33.0
More information about the wine-devel
mailing list