winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
April 2023
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
817 discussions
Start a n
N
ew thread
Conor McCarthy : vkd3d: Ensure descriptors are pointer aligned.
by Alexandre Julliard
25 Apr '23
25 Apr '23
Module: vkd3d Branch: master Commit: 505c8c5a2f4ddecb03128370a3381f276efdfe7c URL:
https://gitlab.winehq.org/wine/vkd3d/-/commit/505c8c5a2f4ddecb03128370a3381…
Author: Conor McCarthy <cmccarthy(a)codeweavers.com> Date: Thu Apr 13 00:44:00 2023 +1000 vkd3d: Ensure descriptors are pointer aligned. The descriptor structure contains pointer and size types. --- libs/vkd3d/vkd3d_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index ab88f8bf..2128acd8 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -866,7 +866,7 @@ struct d3d12_descriptor_heap struct d3d12_descriptor_heap_vk_set vk_descriptor_sets[VKD3D_SET_INDEX_COUNT]; struct vkd3d_mutex vk_sets_mutex; - BYTE descriptors[]; + uint8_t DECLSPEC_ALIGN(sizeof(void *)) descriptors[]; }; static inline struct d3d12_descriptor_heap *d3d12_desc_get_descriptor_heap(const struct d3d12_desc *descriptor)
1
0
0
0
Henri Verbeet : d3d10: Implement parse_fx10_preshader() on top of vkd3d_shader_parse_dxbc().
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 5ad68393ecc8bc05d7256352019c0d72c3cfeb63 URL:
https://gitlab.winehq.org/wine/wine/-/commit/5ad68393ecc8bc05d7256352019c0d…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Mon Apr 10 09:33:44 2023 +0200 d3d10: Implement parse_fx10_preshader() on top of vkd3d_shader_parse_dxbc(). --- dlls/d3d10/effect.c | 116 ++++++++++++---------------------------------------- 1 file changed, 27 insertions(+), 89 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 1d2b46523ad..779bf878651 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -29,7 +29,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d10); #define MAKE_TAG(ch0, ch1, ch2, ch3) \ ((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \ ((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 )) -#define TAG_DXBC MAKE_TAG('D', 'X', 'B', 'C') #define TAG_FX10 MAKE_TAG('F', 'X', '1', '0') #define TAG_FXLC MAKE_TAG('F', 'X', 'L', 'C') #define TAG_CLI4 MAKE_TAG('C', 'L', 'I', '4') @@ -1146,89 +1145,6 @@ static BOOL require_space(size_t offset, size_t count, size_t size, size_t data_ return !count || (data_size - offset) / count >= size; } -static HRESULT parse_dxbc(const char *data, SIZE_T data_size, - HRESULT (*chunk_handler)(const char *data, size_t data_size, uint32_t tag, void *ctx), void *ctx) -{ - const char *ptr = data; - uint32_t chunk_count; - uint32_t total_size; - HRESULT hr = S_OK; - uint32_t version; - unsigned int i; - uint32_t tag; - - if (!data) - { - WARN("No data supplied.\n"); - return E_FAIL; - } - - tag = read_u32(&ptr); - TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4)); - - if (tag != TAG_DXBC) - { - WARN("Wrong tag.\n"); - return E_FAIL; - } - - FIXME("Skipping DXBC checksum.\n"); - skip_u32_unknown(&ptr, 4); - - version = read_u32(&ptr); - TRACE("version: %#x.\n", version); - if (version != 0x00000001) - { - WARN("Got unexpected DXBC version %#x.\n", version); - return E_FAIL; - } - - total_size = read_u32(&ptr); - TRACE("Total size: %#x.\n", total_size); - - if (data_size != total_size) - { - WARN("Wrong size supplied.\n"); - return E_FAIL; - } - - chunk_count = read_u32(&ptr); - TRACE("Chunk count: %#x.\n", chunk_count); - - for (i = 0; i < chunk_count; ++i) - { - uint32_t chunk_tag, chunk_size; - const char *chunk_ptr; - uint32_t chunk_offset; - - chunk_offset = read_u32(&ptr); - TRACE("Chunk %u at offset %#x.\n", i, chunk_offset); - - if (chunk_offset >= data_size || !require_space(chunk_offset, 2, sizeof(uint32_t), data_size)) - { - WARN("Invalid chunk offset %#x (data size %#Ix).\n", chunk_offset, data_size); - return E_FAIL; - } - - chunk_ptr = data + chunk_offset; - - chunk_tag = read_u32(&chunk_ptr); - chunk_size = read_u32(&chunk_ptr); - - if (!require_space(chunk_ptr - data, 1, chunk_size, data_size)) - { - WARN("Invalid chunk size %#x (data size %#Ix, chunk offset %#x).\n", - chunk_size, data_size, chunk_offset); - return E_FAIL; - } - - if (FAILED(hr = chunk_handler(chunk_ptr, chunk_size, chunk_tag, ctx))) - break; - } - - return hr; -} - static BOOL fx10_get_string(const char *data, size_t data_size, uint32_t offset, const char **s, size_t *l) { size_t len, max_len; @@ -2620,8 +2536,13 @@ static HRESULT parse_fx10_ctab(void *ctx, const char *data, unsigned int data_si return S_OK; } -static HRESULT fxlvm_chunk_handler(const char *data, size_t data_size, uint32_t tag, void *ctx) +static HRESULT fxlvm_chunk_handler(const struct vkd3d_shader_dxbc_section_desc *section, + struct d3d10_preshader_parse_context *ctx) { + const char *data = section->data.code; + size_t data_size = section->data.size; + uint32_t tag = section->tag; + TRACE("Chunk tag: %s, size: %Iu.\n", debugstr_an((const char *)&tag, 4), data_size); switch (tag) @@ -2644,16 +2565,33 @@ static HRESULT fxlvm_chunk_handler(const char *data, size_t data_size, uint32_t static HRESULT parse_fx10_preshader(const char *data, size_t data_size, struct d3d10_effect *effect, struct d3d10_effect_preshader *preshader) { + const struct vkd3d_shader_code dxbc = {.code = data, .size = data_size}; + const struct vkd3d_shader_dxbc_section_desc *section; struct d3d10_preshader_parse_context context; - HRESULT hr; + struct vkd3d_shader_dxbc_desc dxbc_desc; + HRESULT hr = S_OK; + unsigned int i; + int ret; memset(preshader, 0, sizeof(*preshader)); memset(&context, 0, sizeof(context)); context.preshader = preshader; context.effect = effect; - if (FAILED(hr = parse_dxbc(data, data_size, fxlvm_chunk_handler, &context))) - return hr; + if ((ret = vkd3d_shader_parse_dxbc(&dxbc, 0, &dxbc_desc, NULL)) < 0) + { + WARN("Failed to parse DXBC, ret %d.\n", ret); + return E_FAIL; + } + + for (i = 0; i < dxbc_desc.section_count; ++i) + { + section = &dxbc_desc.sections[i]; + if (FAILED(hr = fxlvm_chunk_handler(section, &context))) + break; + } + + vkd3d_shader_free_dxbc(&dxbc_desc); /* Constant buffer and literal constants are preallocated, validate here that expression has no invalid accesses for those. */ @@ -2671,7 +2609,7 @@ static HRESULT parse_fx10_preshader(const char *data, size_t data_size, return E_FAIL; } - return S_OK; + return hr; } static HRESULT d3d10_effect_add_prop_dependency(struct d3d10_effect_prop_dependencies *d,
1
0
0
0
Henri Verbeet : d3d10: Implement d3d10_effect_parse() on top of vkd3d_shader_parse_dxbc().
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 93cc58d12190c4536db34401dee8f157883a6d99 URL:
https://gitlab.winehq.org/wine/wine/-/commit/93cc58d12190c4536db34401dee8f1…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Mon Apr 10 09:33:44 2023 +0200 d3d10: Implement d3d10_effect_parse() on top of vkd3d_shader_parse_dxbc(). --- dlls/d3d10/effect.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 61c76416273..1d2b46523ad 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -19,6 +19,7 @@ */ #include "d3d10_private.h" +#include <vkd3d_shader.h> #include <float.h> #include <stdint.h> @@ -4056,28 +4057,42 @@ static HRESULT parse_fx10(struct d3d10_effect *e, const char *data, size_t data_ return parse_fx10_body(e, ptr, data_size - (ptr - data)); } -static HRESULT fx10_chunk_handler(const char *data, size_t data_size, uint32_t tag, void *ctx) +HRESULT d3d10_effect_parse(struct d3d10_effect *effect, const void *data, SIZE_T data_size) { - struct d3d10_effect *e = ctx; - - TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4)); + const struct vkd3d_shader_code dxbc = {.code = data, .size = data_size}; + const struct vkd3d_shader_dxbc_section_desc *section; + struct vkd3d_shader_dxbc_desc dxbc_desc; + HRESULT hr = S_OK; + unsigned int i; + int ret; - TRACE("Chunk size: %#Ix.\n", data_size); + if ((ret = vkd3d_shader_parse_dxbc(&dxbc, 0, &dxbc_desc, NULL)) < 0) + { + WARN("Failed to parse DXBC, ret %d.\n", ret); + return E_FAIL; + } - switch(tag) + for (i = 0; i < dxbc_desc.section_count; ++i) { - case TAG_FX10: - return parse_fx10(e, data, data_size); + section = &dxbc_desc.sections[i]; - default: - FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)&tag, 4)); - return S_OK; + TRACE("Section %u: tag %s, data {%p, %#Ix}.\n", + i, debugstr_an((const char *)§ion->tag, 4), + section->data.code, section->data.size); + + if (section->tag != TAG_FX10) + { + FIXME("Unhandled chunk %s.\n", debugstr_an((const char *)§ion->tag, 4)); + continue; + } + + if (FAILED(hr = parse_fx10(effect, section->data.code, section->data.size))) + break; } -} -HRESULT d3d10_effect_parse(struct d3d10_effect *effect, const void *data, SIZE_T data_size) -{ - return parse_dxbc(data, data_size, fx10_chunk_handler, effect); + vkd3d_shader_free_dxbc(&dxbc_desc); + + return hr; } static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_variable *s,
1
0
0
0
Paul Gofman : ntdll: Avoid integer overflow in block_get_subheap().
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 27c4c64c367f47fe7914c5c87596e6cf3501dbd6 URL:
https://gitlab.winehq.org/wine/wine/-/commit/27c4c64c367f47fe7914c5c87596e6…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Fri Apr 21 19:19:20 2023 -0600 ntdll: Avoid integer overflow in block_get_subheap(). --- dlls/ntdll/heap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index d8dab867ff5..ef1a9c3f3b1 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -359,7 +359,7 @@ static inline void block_set_type( struct block *block, UINT type ) static inline SUBHEAP *block_get_subheap( const struct heap *heap, const struct block *block ) { char *offset = ROUND_ADDR( block, REGION_ALIGN - 1 ); - void *base = offset - block->base_offset * REGION_ALIGN; + void *base = offset - (SIZE_T)block->base_offset * REGION_ALIGN; if (base != (void *)heap) return base; else return (SUBHEAP *)&heap->subheap; }
1
0
0
0
Paul Gofman : ntdll: Mind LFH pending blocks in RtlDestroyHeap().
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 74e0c4ce6b8216610f28df6db9bc38014ac871c2 URL:
https://gitlab.winehq.org/wine/wine/-/commit/74e0c4ce6b8216610f28df6db9bc38…
Author: Paul Gofman <pgofman(a)codeweavers.com> Date: Thu Apr 20 17:58:51 2023 -0600 ntdll: Mind LFH pending blocks in RtlDestroyHeap(). --- dlls/ntdll/heap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 7547ac50f61..d8dab867ff5 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -326,6 +326,8 @@ C_ASSERT( offsetof(struct heap, subheap) <= REGION_ALIGN - 1 ); static struct heap *process_heap; /* main process heap */ +static NTSTATUS heap_free_block_lfh( struct heap *heap, ULONG flags, struct block *block ); + /* check if memory range a contains memory range b */ static inline BOOL contains( const void *a, SIZE_T a_size, const void *b, SIZE_T b_size ) { @@ -1640,7 +1642,10 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE handle ) { heap->pending_free = NULL; for (tmp = pending; *tmp && tmp != pending + MAX_FREE_PENDING; ++tmp) + { + if (!heap_free_block_lfh( heap, heap->flags, *tmp )) continue; heap_free_block( heap, heap->flags, *tmp ); + } RtlFreeHeap( handle, 0, pending ); }
1
0
0
0
Alistair Leslie-Hughes : widl: Suppress a coverity warning.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 1aa6a900e83e410602c49e085cb95d13935b74f9 URL:
https://gitlab.winehq.org/wine/wine/-/commit/1aa6a900e83e410602c49e085cb95d…
Author: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com> Date: Mon Apr 3 18:14:53 2023 +1000 widl: Suppress a coverity warning. Knowning that frame->code will be set when the exception handler is called. Suppress this coverity issue. --- tools/widl/proxy.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index a80aa5d77fe..3d55cd73ee7 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -298,6 +298,7 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx, if (has_ret) { indent++; proxy_free_variables( type_function_get_args(func->declspec.type), "" ); + print_proxy( "/* coverity[uninit_use_in_call:SUPPRESS] */\n" ); print_proxy( "_RetVal = NdrProxyErrorHandler(RpcExceptionCode());\n" ); indent--; }
1
0
0
0
Alex Henrie : ntdll: Increment offset by len in build_clr_surrogate_section.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 7af7ff872b3b1f3ab82a2b666cae2bd3d9401006 URL:
https://gitlab.winehq.org/wine/wine/-/commit/7af7ff872b3b1f3ab82a2b666cae2b…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Thu Apr 20 09:03:47 2023 -0600 ntdll: Increment offset by len in build_clr_surrogate_section. Instead of multiplying it by 2. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54808
Co-authored-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/kernel32/tests/actctx.c | 38 +++++++++++++++++++++++++++++++++++++- dlls/ntdll/actctx.c | 2 +- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index 3d547e01b19..2225215be8a 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -147,6 +147,11 @@ static const char manifest3[] = " name=\"testsurrogate\"" " runtimeVersion=\"v2.0.50727\"" " />" +" <clrSurrogate " +" clsid=\"{96666666-8888-7777-6666-555555555556}\"" +" name=\"testsurrogate\"" +" runtimeVersion=\"v2.0.50728\"" +" />" " <clrClass " " clsid=\"{22345678-1234-5678-1234-111122223333}\"" " name=\"clrclass\"" @@ -1592,6 +1597,29 @@ struct clrclass_data { DWORD res2[2]; }; +static void validate_guid_index(const ACTCTX_SECTION_KEYED_DATA *data, int line) +{ +#define GUIDSECTION_MAGIC 0x64487347 /* dHsG */ + struct guidsection_header *header; + struct guid_index *index; + unsigned int i; + + header = (struct guidsection_header *)data->lpSectionBase; + + ok_(__FILE__, line)(header->magic == GUIDSECTION_MAGIC, "Unexpected magic %#lx.\n", header->magic); + ok_(__FILE__, line)(header->size == sizeof(*header), "Unexpected size %ld.\n", header->size); + ok_(__FILE__, line)(header->index_offset >= sizeof(*header), "Unexpected index offset %lu.\n", header->index_offset); + + index = (struct guid_index *)((BYTE *)data->lpSectionBase + header->index_offset); + for (i = 0; i < header->count; ++i) + { + ok_(__FILE__, line)(index[i].data_len <= data->ulSectionTotalLength, "Unexpected data length.\n"); + ok_(__FILE__, line)(index[i].data_offset <= data->ulSectionTotalLength - index[i].data_len, + "Unexpected data offset %ld, section total length %lu, data length %lu.\n", + index[i].data_offset, data->ulSectionTotalLength, index[i].data_len); + } +} + static void test_find_com_redirection(HANDLE handle, const GUID *clsid, const GUID *tlid, const WCHAR *progid, ULONG exid, int line) { struct comclassredirect_data *comclass, *comclass2; @@ -1715,6 +1743,7 @@ static void test_find_com_redirection(HANDLE handle, const GUID *clsid, const GU ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx); ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n", data.ulAssemblyRosterIndex, exid); + validate_guid_index(&data, line); /* generated guid for this class works as key guid in search */ memset(&data2, 0xfe, sizeof(data2)); @@ -1801,6 +1830,8 @@ static void test_find_ifaceps_redirection(HANDLE handle, const GUID *iid, const ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx); ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n", data.ulAssemblyRosterIndex, exid); + + validate_guid_index(&data, line); } struct clrsurrogate_data @@ -1815,7 +1846,7 @@ struct clrsurrogate_data }; static void test_find_surrogate(HANDLE handle, const GUID *clsid, const WCHAR *name, const WCHAR *version, - ULONG exid, int line) + ULONG exid, int line) { struct clrsurrogate_data *surrogate; ACTCTX_SECTION_KEYED_DATA data; @@ -1871,6 +1902,8 @@ static void test_find_surrogate(HANDLE handle, const GUID *clsid, const WCHAR *n ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx); ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n", data.ulAssemblyRosterIndex, exid); + + validate_guid_index(&data, line); } static void test_find_progid_redirection(HANDLE handle, const GUID *clsid, const char *progid, ULONG exid, int line) @@ -1911,6 +1944,8 @@ static void test_find_progid_redirection(HANDLE handle, const GUID *clsid, const comclass = (struct comclassredirect_data*)data2.lpData; ok_(__FILE__, line)(IsEqualGUID(guid, &comclass->alias), "got wrong alias referenced from progid %s, %s\n", progid, wine_dbgstr_guid(guid)); ok_(__FILE__, line)(IsEqualGUID(clsid, &comclass->clsid), "got wrong class referenced from progid %s, %s\n", progid, wine_dbgstr_guid(clsid)); + + validate_guid_index(&data2, line); } header = (struct strsection_header*)data.lpSectionBase; @@ -2076,6 +2111,7 @@ static void test_typelib_section(void) section = (struct guidsection_header*)data.lpSectionBase; ok(section->count == 4, "got %ld\n", section->count); ok(section->size == sizeof(*section), "got %ld\n", section->size); + validate_guid_index(&data, __LINE__); /* For both GUIDs same section is returned */ ok(data.lpSectionBase == data2.lpSectionBase, "got %p, %p\n", data.lpSectionBase, data2.lpSectionBase); diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index 08a4893a85d..54167a2db67 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -4828,7 +4828,7 @@ static NTSTATUS build_clr_surrogate_section(ACTIVATION_CONTEXT* actctx, struct g ptrW[data->version_len/sizeof(WCHAR)] = 0; } - data_offset += index->data_offset; + data_offset += index->data_len; index++; } }
1
0
0
0
Alex Henrie : kernel32/tests: Check that lpSectionBase != NULL before dereferencing.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: bd7459579d1fa448912151fd2d51564eb6b8716d URL:
https://gitlab.winehq.org/wine/wine/-/commit/bd7459579d1fa448912151fd2d5156…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Wed Apr 12 22:58:06 2023 -0600 kernel32/tests: Check that lpSectionBase != NULL before dereferencing. If lpSectionBase is null then the tests will still crash, but at least we'll know why. --- dlls/kernel32/tests/actctx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index da351e70466..3d547e01b19 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -1454,8 +1454,8 @@ static void test_find_activatable_class(HANDLE handle, const WCHAR *classid, enu ok_(__FILE__, line)(data.lpData != NULL, "got lpData %p\n", data.lpData); header = (struct strsection_header *)data.lpSectionBase; - ok_(__FILE__, line)(header->magic == 0x64487353, "got wrong magic 0x%08lx\n", header->magic); ok_(__FILE__, line)(data.lpSectionBase != NULL, "got lpSectionBase %p\n", data.lpSectionBase); + ok_(__FILE__, line)(header->magic == 0x64487353, "got wrong magic 0x%08lx\n", header->magic); ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "got ulSectionTotalLength %lu\n", data.ulSectionTotalLength); ok_(__FILE__, line)(data.lpSectionGlobalData == (BYTE *)header + header->global_offset, "got lpSectionGlobalData %p\n", data.lpSectionGlobalData); @@ -1706,10 +1706,10 @@ static void test_find_com_redirection(HANDLE handle, const GUID *clsid, const GU } header = (struct guidsection_header*)data.lpSectionBase; + ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n"); ok_(__FILE__, line)(data.lpSectionGlobalData == ((BYTE*)header + header->names_offset), "data.lpSectionGlobalData == NULL\n"); ok_(__FILE__, line)(data.ulSectionGlobalDataLength == header->names_len, "data.ulSectionGlobalDataLength=%lu\n", data.ulSectionGlobalDataLength); - ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n"); ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n", data.ulSectionTotalLength); ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx); @@ -1914,9 +1914,9 @@ static void test_find_progid_redirection(HANDLE handle, const GUID *clsid, const } header = (struct strsection_header*)data.lpSectionBase; + ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n"); ok_(__FILE__, line)(data.lpSectionGlobalData == (BYTE*)header + header->global_offset, "data.lpSectionGlobalData == NULL\n"); ok_(__FILE__, line)(data.ulSectionGlobalDataLength == header->global_len, "data.ulSectionGlobalDataLength=%lu\n", data.ulSectionGlobalDataLength); - ok_(__FILE__, line)(data.lpSectionBase != NULL, "data.lpSectionBase == NULL\n"); ok_(__FILE__, line)(data.ulSectionTotalLength > 0, "data.ulSectionTotalLength=%lu\n", data.ulSectionTotalLength); ok_(__FILE__, line)(data.hActCtx == NULL, "data.hActCtx=%p\n", data.hActCtx); ok_(__FILE__, line)(data.ulAssemblyRosterIndex == exid, "data.ulAssemblyRosterIndex=%lu, expected %lu\n",
1
0
0
0
Alexandre Julliard : ntdll: Reimplement RtlNumberOfSetBits() to check 32 bits at a time.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 2371906a25635c2ff7c439b5a4ca89390c79fa56 URL:
https://gitlab.winehq.org/wine/wine/-/commit/2371906a25635c2ff7c439b5a4ca89…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Apr 22 17:34:11 2023 +0200 ntdll: Reimplement RtlNumberOfSetBits() to check 32 bits at a time. --- dlls/ntdll/rtlbitmap.c | 60 ++++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 43 deletions(-) diff --git a/dlls/ntdll/rtlbitmap.c b/dlls/ntdll/rtlbitmap.c index b6225165840..4bf028fbe36 100644 --- a/dlls/ntdll/rtlbitmap.c +++ b/dlls/ntdll/rtlbitmap.c @@ -37,14 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ntdll); -/* Bits set from LSB to MSB; used as mask for runs < 8 bits */ -static const BYTE NTDLL_maskBits[8] = { 0, 1, 3, 7, 15, 31, 63, 127 }; - -/* Number of set bits for each value of a nibble; used for counting */ -static const BYTE NTDLL_nibbleBitCount[16] = { - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 -}; - /* First set bit in a nibble; used for determining least significant bit */ static const BYTE NTDLL_leastSignificant[16] = { 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 @@ -60,6 +52,17 @@ static inline ULONG maskbits( ULONG idx ) return ~0u << (idx & 31); } +static ULONG popcount( ULONG val ) +{ +#if defined(__MINGW32__) + return __builtin_popcount( val ); +#else + val -= val >> 1 & 0x55555555; + val = (val & 0x33333333) + (val >> 2 & 0x33333333); + return ((val + (val >> 4)) & 0x0f0f0f0f) * 0x01010101 >> 24; +#endif +} + /************************************************************************* * RtlInitializeBitMap [NTDLL.@] * @@ -352,45 +355,16 @@ ULONG WINAPI RtlFindClearBitsAndSet(PRTL_BITMAP lpBits, ULONG ulCount, ULONG ulH /************************************************************************* * RtlNumberOfSetBits [NTDLL.@] - * - * Find the number of set bits in a bitmap. - * - * PARAMS - * lpBits [I] Bitmap pointer - * - * RETURNS - * The number of set bits. */ -ULONG WINAPI RtlNumberOfSetBits(PCRTL_BITMAP lpBits) +ULONG WINAPI RtlNumberOfSetBits( const RTL_BITMAP *bitmap ) { - ULONG ulSet = 0; + ULONG i, ret = 0; - TRACE("(%p)\n", lpBits); - - if (lpBits) - { - LPBYTE lpOut = (BYTE *)lpBits->Buffer; - ULONG ulCount, ulRemainder; - BYTE bMasked; - - ulCount = lpBits->SizeOfBitMap >> 3; - ulRemainder = lpBits->SizeOfBitMap & 0x7; - - while (ulCount--) - { - ulSet += NTDLL_nibbleBitCount[*lpOut >> 4]; - ulSet += NTDLL_nibbleBitCount[*lpOut & 0xf]; - lpOut++; - } + for (i = 0; i < bitmap->SizeOfBitMap / 32; i++) ret += popcount( bitmap->Buffer[i] ); + if (bitmap->SizeOfBitMap & 31) ret += popcount( bitmap->Buffer[i] & ~maskbits( bitmap->SizeOfBitMap )); - if (ulRemainder) - { - bMasked = *lpOut & NTDLL_maskBits[ulRemainder]; - ulSet += NTDLL_nibbleBitCount[bMasked >> 4]; - ulSet += NTDLL_nibbleBitCount[bMasked & 0xf]; - } - } - return ulSet; + TRACE( "%p -> %lu\n", bitmap, ret ); + return ret; } /*************************************************************************
1
0
0
0
Alexandre Julliard : ntdll: Reimplement RtlAreBitsClear() to check 32 bits at a time.
by Alexandre Julliard
24 Apr '23
24 Apr '23
Module: wine Branch: master Commit: 504f9d3cb8680e6c8f4a6bb44eb5bd9e197859eb URL:
https://gitlab.winehq.org/wine/wine/-/commit/504f9d3cb8680e6c8f4a6bb44eb5bd…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Sat Apr 22 17:33:32 2023 +0200 ntdll: Reimplement RtlAreBitsClear() to check 32 bits at a time. --- dlls/ntdll/rtlbitmap.c | 70 ++++++++------------------------------------------ 1 file changed, 11 insertions(+), 59 deletions(-) diff --git a/dlls/ntdll/rtlbitmap.c b/dlls/ntdll/rtlbitmap.c index 17a8f8b3134..b6225165840 100644 --- a/dlls/ntdll/rtlbitmap.c +++ b/dlls/ntdll/rtlbitmap.c @@ -186,72 +186,24 @@ BOOLEAN WINAPI RtlAreBitsSet( const RTL_BITMAP *bitmap, ULONG start, ULONG count /************************************************************************* * RtlAreBitsClear [NTDLL.@] - * - * Determine if part of a bitmap is clear. - * - * PARAMS - * lpBits [I] Bitmap pointer - * ulStart [I] First bit to check from - * ulCount [I] Number of consecutive bits to check - * - * RETURNS - * TRUE, If ulCount bits from ulStart are clear. - * FALSE, Otherwise. */ -BOOLEAN WINAPI RtlAreBitsClear(PCRTL_BITMAP lpBits, ULONG ulStart, ULONG ulCount) +BOOLEAN WINAPI RtlAreBitsClear( const RTL_BITMAP *bitmap, ULONG start, ULONG count ) { - LPBYTE lpOut; - ULONG ulRemainder; - - TRACE("(%p,%lu,%lu)\n", lpBits, ulStart, ulCount); - - if (!lpBits || !ulCount || - ulStart >= lpBits->SizeOfBitMap || - ulCount > lpBits->SizeOfBitMap - ulStart) - return FALSE; - - /* FIXME: It might be more efficient/cleaner to manipulate four bytes - * at a time. But beware of the pointer arithmetics... - */ - lpOut = ((BYTE*)lpBits->Buffer) + (ulStart >> 3u); + ULONG end = start + count; + ULONG pos = start / 32; + ULONG end_pos = end / 32; - /* Check bits in first byte, if ulStart isn't a byte boundary */ - if (ulStart & 7) - { - if (ulCount > 7) - { - /* Check from start bit to the end of the byte */ - if (*lpOut & ((0xff << (ulStart & 7)) & 0xff)) - return FALSE; - lpOut++; - ulCount -= (8 - (ulStart & 7)); - } - else - { - /* Check from the start bit, possibly into the next byte also */ - USHORT initialWord = NTDLL_maskBits[ulCount] << (ulStart & 7); + TRACE( "(%p,%lu,%lu)\n", bitmap, start, count ); - if (*lpOut & (initialWord & 0xff)) - return FALSE; - if ((initialWord & 0xff00) && (lpOut[1] & (initialWord >> 8))) + if (!count || start >= bitmap->SizeOfBitMap || count > bitmap->SizeOfBitMap - start) return FALSE; - return TRUE; - } - } - /* Check bits in blocks of 8 bytes */ - ulRemainder = ulCount & 7; - ulCount >>= 3; - while (ulCount--) - { - if (*lpOut++) - return FALSE; - } + if (end_pos == pos) return !(bitmap->Buffer[pos] & maskbits( start ) & ~maskbits( end )); - /* Check remaining bits, if any */ - if (ulRemainder && *lpOut & NTDLL_maskBits[ulRemainder]) - return FALSE; - return TRUE; + if (bitmap->Buffer[pos++] & maskbits( start )) return FALSE; + while (pos < end_pos) if (bitmap->Buffer[pos++]) return FALSE; + if (!(end & 31)) return TRUE; + return !(bitmap->Buffer[pos] & ~maskbits( end )); } /*************************************************************************
1
0
0
0
← Newer
1
...
10
11
12
13
14
15
16
...
82
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Results per page:
10
25
50
100
200