Module: wine
Branch: master
Commit: 4bdf92cb7fa9bcd06eef318c57ae1c30fb5a2dd5
URL: https://gitlab.winehq.org/wine/wine/-/commit/4bdf92cb7fa9bcd06eef318c57ae1c…
Author: Eric Pouech <eric.pouech(a)gmail.com>
Date: Fri Sep 16 18:01:53 2022 +0200
jscript: Fix GCC 12.2 warning.
When initializing a jsstr_inline_t with a len < 3, the size passed
for the allocation is smaller then the size of the structure
(as the later is rounded up to the alignment = 4 bytes).
GCC 12.2 complains about this when dereferencing the pointer to
the structure as the size passed for allocation is smaller than the
size of the structure.
The warning is fixed by using flexible array member in
jsstr_inline_t. Given the rounding behavior in memory allocation, this
should not change the size of allocated blocks.
Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com>
---
dlls/jscript/jsstr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/jscript/jsstr.h b/dlls/jscript/jsstr.h
index f42c95de5ea..290ca6e8119 100644
--- a/dlls/jscript/jsstr.h
+++ b/dlls/jscript/jsstr.h
@@ -79,7 +79,7 @@ static inline BOOL jsstr_is_rope(jsstr_t *str)
typedef struct {
jsstr_t str;
- WCHAR buf[1];
+ WCHAR buf[];
} jsstr_inline_t;
typedef struct {