this prevents mingw-gcc version 11 to generate warnings (-Warray-bounds) Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/ntdll/tests/info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index e9d42127c3e..d6b323dd9d7 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -1461,7 +1461,7 @@ static void test_query_firmware(void) NTSTATUS status; SYSTEM_FIRMWARE_TABLE_INFORMATION *sfti;
- sfti = HeapAlloc(GetProcessHeap(), 0, min_sfti_len); + sfti = HeapAlloc(GetProcessHeap(), 0, sizeof(*sfti)); ok(!!sfti, "Failed to allocate memory\n");
sfti->ProviderSignature = 0;
this prevents mingw-gcc version 11 to generate warnings (-Warray-bounds)
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/kernel32/tests/version.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/kernel32/tests/version.c b/dlls/kernel32/tests/version.c index ad87bb38a16..ec74c920960 100644 --- a/dlls/kernel32/tests/version.c +++ b/dlls/kernel32/tests/version.c @@ -715,7 +715,7 @@ static void test_GetSystemFirmwareTable(void) return; }
- sfti = HeapAlloc(GetProcessHeap(), 0, min_sfti_len); + sfti = HeapAlloc(GetProcessHeap(), 0, sizeof(*sfti)); ok(!!sfti, "Failed to allocate memory\n"); sfti->ProviderSignature = RSMB; sfti->Action = SystemFirmwareTable_Get;
this prevents mingw-gcc version 11 to generate warnings (-Warray-bounds)
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/ntdll/tests/reg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/tests/reg.c b/dlls/ntdll/tests/reg.c index bd8d531edf0..7d069666604 100644 --- a/dlls/ntdll/tests/reg.c +++ b/dlls/ntdll/tests/reg.c @@ -742,7 +742,7 @@ static void test_NtQueryValueKey(void) ok(status == STATUS_SUCCESS, "NtOpenKey Failed: 0x%08x\n", status);
len = FIELD_OFFSET(KEY_VALUE_BASIC_INFORMATION, Name[0]); - basic_info = HeapAlloc(GetProcessHeap(), 0, len); + basic_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*basic_info)); status = pNtQueryValueKey(key, &ValName, KeyValueBasicInformation, basic_info, len, &len); ok(status == STATUS_BUFFER_OVERFLOW, "NtQueryValueKey should have returned STATUS_BUFFER_OVERFLOW instead of 0x%08x\n", status); ok(basic_info->TitleIndex == 0, "NtQueryValueKey returned wrong TitleIndex %d\n", basic_info->TitleIndex); @@ -761,7 +761,7 @@ static void test_NtQueryValueKey(void) HeapFree(GetProcessHeap(), 0, basic_info);
len = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[0]); - partial_info = HeapAlloc(GetProcessHeap(), 0, len); + partial_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*partial_info)); status = pNtQueryValueKey(key, &ValName, KeyValuePartialInformation, partial_info, len, &len); ok(status == STATUS_BUFFER_OVERFLOW, "NtQueryValueKey should have returned STATUS_BUFFER_OVERFLOW instead of 0x%08x\n", status); ok(partial_info->TitleIndex == 0, "NtQueryValueKey returned wrong TitleIndex %d\n", partial_info->TitleIndex); @@ -780,7 +780,7 @@ static void test_NtQueryValueKey(void) HeapFree(GetProcessHeap(), 0, partial_info);
len = FIELD_OFFSET(KEY_VALUE_FULL_INFORMATION, Name[0]); - full_info = HeapAlloc(GetProcessHeap(), 0, len); + full_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*full_info)); status = pNtQueryValueKey(key, &ValName, KeyValueFullInformation, full_info, len, &len); ok(status == STATUS_BUFFER_OVERFLOW, "NtQueryValueKey should have returned STATUS_BUFFER_OVERFLOW instead of 0x%08x\n", status); ok(full_info->TitleIndex == 0, "NtQueryValueKey returned wrong TitleIndex %d\n", full_info->TitleIndex);
this fixes a couple of GCC11 warnings (-Warray-bounds)
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/quartz/avidec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c index f8660890273..19aec0738c9 100644 --- a/dlls/quartz/avidec.c +++ b/dlls/quartz/avidec.c @@ -342,9 +342,9 @@ static HRESULT avi_decompressor_source_get_media_type(struct strmbase_pin *iface
if (index < ARRAY_SIZE(formats)) { - if (!(format = CoTaskMemAlloc(offsetof(VIDEOINFO, dwBitMasks[3])))) + if (!(format = CoTaskMemAlloc(sizeof(VIDEOINFO)))) return E_OUTOFMEMORY; - memset(format, 0, offsetof(VIDEOINFO, dwBitMasks[3])); + memset(format, 0, sizeof(VIDEOINFO));
format->rcSource = sink_format->rcSource; format->rcTarget = sink_format->rcTarget;
size of 20 used in most of the tests is not necessarly wrong wrt the fields adressed, even if I don't fully grasp the logic of a 20 byte buffer: - VARIANT is 16 bytes on 32bit systems, and 24 bytes on 64 bit systems - and all the other structures are 16 bytes at most
anyway, make it always of the size of a VARIANT, in order to keep gcc happy
Signed-off-by: Eric Pouech eric.pouech@gmail.com
--- dlls/oledb32/tests/convert.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c index 0d888e834e3..7144150c2bc 100644 --- a/dlls/oledb32/tests/convert.c +++ b/dlls/oledb32/tests/convert.c @@ -327,7 +327,7 @@ static void test_converttoi1(void) { HRESULT hr; signed char dst; - BYTE src[20]; + BYTE src[sizeof(VARIANT)]; /* assuming that VARIANT is larger than all the types used in src */ DBSTATUS dst_status; DBLENGTH dst_len; static const WCHAR ten[] = {'1','0',0}; @@ -638,7 +638,7 @@ static void test_converttoi2(void) { HRESULT hr; signed short dst; - BYTE src[20]; + BYTE src[sizeof(VARIANT)]; /* assuming that VARIANT is larger than all the types used in src */ DBSTATUS dst_status; DBLENGTH dst_len; static const WCHAR ten[] = {'1','0',0}; @@ -950,7 +950,7 @@ static void test_converttoi4(void) { HRESULT hr; INT i4; - BYTE src[20]; + BYTE src[sizeof(VARIANT)]; /* assuming that VARIANT is larger than all the types used in src */ DBSTATUS dst_status; DBLENGTH dst_len; static const WCHAR ten[] = {'1','0',0}; @@ -1224,7 +1224,7 @@ static void test_converttoi8(void) { HRESULT hr; LARGE_INTEGER dst; - BYTE src[20]; + BYTE src[sizeof(VARIANT)]; /* assuming that VARIANT is larger than all the types used in src */ DBSTATUS dst_status; DBLENGTH dst_len; static const WCHAR ten[] = {'1','0',0}; @@ -2774,7 +2774,7 @@ static void test_converttoui4(void) { HRESULT hr; DWORD dst; - BYTE src[20]; + BYTE src[sizeof(VARIANT)]; DBSTATUS dst_status; DBLENGTH dst_len;