Added first part of patchset containing various improvements for LsaLookupSids.

This commit is contained in:
Sebastian Lackner 2015-04-10 05:28:45 +02:00
parent 0412f2dcbc
commit 77bc095cb4
5 changed files with 172 additions and 34 deletions

1
debian/changelog vendored
View File

@ -2,6 +2,7 @@ wine-staging (1.7.41) UNRELEASED; urgency=low
* Disable DXVA2 controls in winecfg when support is not compiled in.
* Added patch to enable/disable EAX support via winecfg.
* Added patch with stub for setupapi.SetupDiSetDeviceInstallParamsW.
* Added first part of patchset containing various improvements for LsaLookupSids.
* Added tests for RtlIpv6AddressToString and RtlIpv6AddressToStringEx.
* Removed patches to fix invalid memory access in get_registry_locale_info (accepted upstream).
* Removed patches to avoid repeated FIXMEs in PsLookupProcessByProcessId stub (accepted upstream).

View File

@ -0,0 +1,31 @@
From be28c746d013c16fa6c2e50f5f9debc45d39d81b Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Tue, 7 Apr 2015 13:18:31 +0800
Subject: advapi32: Initialize buffer length to zero in LsaLookupSids to
prevent crash. (try 2)
Superseded 110588-110594
Try 2:
- Use RtlInitUnicodeStringEx to simplify code when possible. Same for
other patches in this series. (Thanks Nikolay)
---
dlls/advapi32/lsa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c
index 2a8b791..69c29c5 100644
--- a/dlls/advapi32/lsa.c
+++ b/dlls/advapi32/lsa.c
@@ -502,7 +502,7 @@ NTSTATUS WINAPI LsaLookupSids(
{
(*Names)[i].Use = SidTypeUnknown;
(*Names)[i].DomainIndex = -1;
- (*Names)[i].Name.Buffer = NULL;
+ RtlInitUnicodeStringEx(&(*Names)[i].Name, NULL);
memset(&(*ReferencedDomains)->Domains[i], 0, sizeof(LSA_TRUST_INFORMATION));
--
2.3.5

View File

@ -0,0 +1,47 @@
From 246cb6b72666dcb77fb2f553d318d7dabbe8811d Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Tue, 7 Apr 2015 13:18:47 +0800
Subject: advapi32: Prepend a hidden LSA_TRUST_INFORMATION in LsaLookupSids to
avoid crash when Domains[-1] incorrectly accessed by application. (try 2)
---
dlls/advapi32/lsa.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c
index 69c29c5..dfe25b3 100644
--- a/dlls/advapi32/lsa.c
+++ b/dlls/advapi32/lsa.c
@@ -488,14 +488,17 @@ NTSTATUS WINAPI LsaLookupSids(
if (!(*Names = heap_alloc(name_fullsize))) return STATUS_NO_MEMORY;
/* maximum count of stored domain infos is Count, allocate it like that cause really needed
count could only be computed after sid data is retrieved */
- domain_fullsize = sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION)*Count;
+ domain_fullsize = sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION) * (Count + 1);
if (!(*ReferencedDomains = heap_alloc(domain_fullsize)))
{
heap_free(*Names);
return STATUS_NO_MEMORY;
}
(*ReferencedDomains)->Entries = 0;
- (*ReferencedDomains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*ReferencedDomains + sizeof(LSA_REFERENCED_DOMAIN_LIST));
+ (*ReferencedDomains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*ReferencedDomains +
+ sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION));
+ (*ReferencedDomains)->Domains[-1].Sid = NULL;
+ RtlInitUnicodeStringEx(&(*ReferencedDomains)->Domains[-1].Name, NULL);
/* Get full names data length and full length needed to store domain name and SID */
for (i = 0; i < Count; i++)
@@ -555,7 +558,8 @@ NTSTATUS WINAPI LsaLookupSids(
*ReferencedDomains = heap_realloc(*ReferencedDomains, domain_fullsize);
/* fix pointer after reallocation */
- (*ReferencedDomains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*ReferencedDomains + sizeof(LSA_REFERENCED_DOMAIN_LIST));
+ (*ReferencedDomains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*ReferencedDomains +
+ sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION));
domain_data = (char*)(*ReferencedDomains)->Domains + sizeof(LSA_TRUST_INFORMATION)*Count;
mapped = 0;
--
2.3.5

View File

@ -0,0 +1,39 @@
From ce254ac3659e0c040136341d035629f99ec6d1ea Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Tue, 7 Apr 2015 13:19:06 +0800
Subject: advapi32: Prepend a hidden LSA_TRUST_INFORMATION in LsaLookupNames2
to avoid crash when Domains[-1] incorrectly accessed by application. (try 2)
---
dlls/advapi32/lsa.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c
index dfe25b3..258b8ca 100644
--- a/dlls/advapi32/lsa.c
+++ b/dlls/advapi32/lsa.c
@@ -404,14 +404,18 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count,
sid = (SID *)(*sids + count);
/* use maximum domain count */
- if (!(*domains = heap_alloc(sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION)*count +
- sid_size_total + domainname_size_total*sizeof(WCHAR))))
+ if (!(*domains = heap_alloc(sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION) * (count + 1) +
+ sid_size_total + domainname_size_total * sizeof(WCHAR))))
{
heap_free(*sids);
return STATUS_NO_MEMORY;
}
(*domains)->Entries = 0;
- (*domains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*domains + sizeof(LSA_REFERENCED_DOMAIN_LIST));
+ (*domains)->Domains = (LSA_TRUST_INFORMATION*)((char*)*domains +
+ sizeof(LSA_REFERENCED_DOMAIN_LIST) + sizeof(LSA_TRUST_INFORMATION));
+ (*domains)->Domains[-1].Sid = NULL;
+ RtlInitUnicodeStringEx(&(*domains)->Domains[-1].Name, NULL);
+
domain_data = (char*)(*domains)->Domains + sizeof(LSA_TRUST_INFORMATION)*count;
domain.Buffer = heap_alloc(domain_size_max*sizeof(WCHAR));
--
2.3.5

View File

@ -66,6 +66,7 @@ patch_enable_all ()
enable_Exagear="$1"
enable_Pipelight="$1"
enable_Staging="$1"
enable_advapi32_LsaLookupSids="$1"
enable_advapi32_Revert_DACL="$1"
enable_browseui_Progress_Dialog="$1"
enable_combase_String="$1"
@ -263,6 +264,9 @@ patch_enable ()
Staging)
enable_Staging="$2"
;;
advapi32-LsaLookupSids)
enable_advapi32_LsaLookupSids="$2"
;;
advapi32-Revert_DACL)
enable_advapi32_Revert_DACL="$2"
;;
@ -1384,6 +1388,22 @@ if test "$enable_Staging" -eq 1; then
) >> "$patchlist"
fi
# Patchset advapi32-LsaLookupSids
# |
# | Modified files:
# | * dlls/advapi32/lsa.c
# |
if test "$enable_advapi32_LsaLookupSids" -eq 1; then
patch_apply advapi32-LsaLookupSids/0001-advapi32-Initialize-buffer-length-to-zero-in-LsaLook.patch
patch_apply advapi32-LsaLookupSids/0002-advapi32-Prepend-a-hidden-LSA_TRUST_INFORMATION-in-L.patch
patch_apply advapi32-LsaLookupSids/0003-advapi32-Prepend-a-hidden-LSA_TRUST_INFORMATION-in-L.patch
(
echo '+ { "Qian Hong", "advapi32: Initialize buffer length to zero in LsaLookupSids to prevent crash.", 2 },';
echo '+ { "Qian Hong", "advapi32: Prepend a hidden LSA_TRUST_INFORMATION in LsaLookupSids to avoid crash when Domains[-1] incorrectly accessed by application.", 2 },';
echo '+ { "Qian Hong", "advapi32: Prepend a hidden LSA_TRUST_INFORMATION in LsaLookupNames2 to avoid crash when Domains[-1] incorrectly accessed by application.", 2 },';
) >> "$patchlist"
fi
# Patchset advapi32-Revert_DACL
# |
# | Modified files:
@ -1965,6 +1985,40 @@ if test "$enable_wined3d_CSMT_Helper" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Revert_PixelFormat
# |
# | This patchset fixes the following Wine bugs:
# | * [#35655] Fix wined3d performance drop introduced by pixelformat changes.
# | * [#35718] Fix flickering introduced by pixelformat changes.
# | * [#35950] Fix black screen on startup introduced by pixelformat changes.
# | * [#35975] Fix gray screen on startup introduced by pixelformat changes.
# | * [#36900] Fix missing video introduced by pixelformat changes.
# |
# | Modified files:
# | * dlls/d3d8/tests/device.c, dlls/d3d9/tests/device.c, dlls/ddraw/tests/ddraw1.c, dlls/ddraw/tests/ddraw2.c,
# | dlls/ddraw/tests/ddraw4.c, dlls/ddraw/tests/ddraw7.c, dlls/wined3d/context.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_Revert_PixelFormat" -eq 1; then
patch_apply wined3d-Revert_PixelFormat/0001-Revert-wined3d-Track-if-a-context-s-private-hdc-has-.patch
patch_apply wined3d-Revert_PixelFormat/0002-Revert-wined3d-Track-if-a-context-s-hdc-is-private-s.patch
patch_apply wined3d-Revert_PixelFormat/0003-Revert-wined3d-When-restoring-pixel-format-in-contex.patch
patch_apply wined3d-Revert_PixelFormat/0004-Revert-wined3d-Don-t-call-GetPixelFormat-to-set-a-fl.patch
patch_apply wined3d-Revert_PixelFormat/0005-Revert-wined3d-Restore-the-pixel-format-of-the-windo.patch
patch_apply wined3d-Revert_PixelFormat/0006-d3d8-Mark-tests-which-no-longer-pass-due-to-reverts-.patch
patch_apply wined3d-Revert_PixelFormat/0007-d3d9-Mark-tests-which-no-longer-pass-due-to-reverts-.patch
patch_apply wined3d-Revert_PixelFormat/0008-ddraw-Mark-tests-which-no-longer-pass-due-to-reverts.patch
(
echo '+ { "Ken Thomases", "Revert \"wined3d: Track if a context'\''s private hdc has had its pixel format set, so we don'\''t need to check it.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Track if a context'\''s hdc is private so we never need to restore its pixel format.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: When restoring pixel format in context_release(), mark the context as needing to be set on the next context_acquire().\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Don'\''t call GetPixelFormat() to set a flag that'\''s already set.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Restore the pixel format of the window whose pixel format was actually changed.\".", 1 },';
echo '+ { "Ken Thomases", "d3d8: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
echo '+ { "Ken Thomases", "d3d9: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
echo '+ { "Ken Thomases", "ddraw: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-UnhandledBlendFactor
# |
# | Modified files:
@ -2016,40 +2070,6 @@ if test "$enable_wined3d_Multisampling" -eq 1; then
) >> "$patchlist"
fi
# Patchset wined3d-Revert_PixelFormat
# |
# | This patchset fixes the following Wine bugs:
# | * [#35655] Fix wined3d performance drop introduced by pixelformat changes.
# | * [#35718] Fix flickering introduced by pixelformat changes.
# | * [#35950] Fix black screen on startup introduced by pixelformat changes.
# | * [#35975] Fix gray screen on startup introduced by pixelformat changes.
# | * [#36900] Fix missing video introduced by pixelformat changes.
# |
# | Modified files:
# | * dlls/d3d8/tests/device.c, dlls/d3d9/tests/device.c, dlls/ddraw/tests/ddraw1.c, dlls/ddraw/tests/ddraw2.c,
# | dlls/ddraw/tests/ddraw4.c, dlls/ddraw/tests/ddraw7.c, dlls/wined3d/context.c, dlls/wined3d/wined3d_private.h
# |
if test "$enable_wined3d_Revert_PixelFormat" -eq 1; then
patch_apply wined3d-Revert_PixelFormat/0001-Revert-wined3d-Track-if-a-context-s-private-hdc-has-.patch
patch_apply wined3d-Revert_PixelFormat/0002-Revert-wined3d-Track-if-a-context-s-hdc-is-private-s.patch
patch_apply wined3d-Revert_PixelFormat/0003-Revert-wined3d-When-restoring-pixel-format-in-contex.patch
patch_apply wined3d-Revert_PixelFormat/0004-Revert-wined3d-Don-t-call-GetPixelFormat-to-set-a-fl.patch
patch_apply wined3d-Revert_PixelFormat/0005-Revert-wined3d-Restore-the-pixel-format-of-the-windo.patch
patch_apply wined3d-Revert_PixelFormat/0006-d3d8-Mark-tests-which-no-longer-pass-due-to-reverts-.patch
patch_apply wined3d-Revert_PixelFormat/0007-d3d9-Mark-tests-which-no-longer-pass-due-to-reverts-.patch
patch_apply wined3d-Revert_PixelFormat/0008-ddraw-Mark-tests-which-no-longer-pass-due-to-reverts.patch
(
echo '+ { "Ken Thomases", "Revert \"wined3d: Track if a context'\''s private hdc has had its pixel format set, so we don'\''t need to check it.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Track if a context'\''s hdc is private so we never need to restore its pixel format.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: When restoring pixel format in context_release(), mark the context as needing to be set on the next context_acquire().\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Don'\''t call GetPixelFormat() to set a flag that'\''s already set.\".", 1 },';
echo '+ { "Ken Thomases", "Revert \"wined3d: Restore the pixel format of the window whose pixel format was actually changed.\".", 1 },';
echo '+ { "Ken Thomases", "d3d8: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
echo '+ { "Ken Thomases", "d3d9: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
echo '+ { "Ken Thomases", "ddraw: Mark tests which no longer pass due to reverts as todo_wine.", 1 },';
) >> "$patchlist"
fi
# Patchset wined3d-CSMT_Main
# |
# | This patchset fixes the following Wine bugs: