summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bruning <michael.bruning@digia.com>2014-02-28 12:43:55 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-28 15:50:42 +0100
commite5b7eec29191033fd71a782c18f5d8437e52856e (patch)
tree54579a1c454d3dedd709ac2ea63ccc96b3f1c3d8
parentae197e4992d9f8c63bf5d0c0f72f712dbe09b1ae (diff)
downloadqtwebkit-e5b7eec29191033fd71a782c18f5d8437e52856e.tar.gz
Account for extra guard page on Windows stack when using Java plugin.
This fixes some ASSERTs when debugging applications that load pages which contain Java applets. Task-number: QTBUG-36591 Change-Id: I65971dc97c3b002a28646916b82a548496c4c4d9 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
-rw-r--r--Source/WTF/wtf/StackBounds.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/WTF/wtf/StackBounds.cpp b/Source/WTF/wtf/StackBounds.cpp
index 62e2665a4..0dc82d2f8 100644
--- a/Source/WTF/wtf/StackBounds.cpp
+++ b/Source/WTF/wtf/StackBounds.cpp
@@ -185,6 +185,11 @@ void StackBounds::initialize()
MEMORY_BASIC_INFORMATION uncommittedMemory;
VirtualQuery(stackOrigin.AllocationBase, &uncommittedMemory, sizeof(uncommittedMemory));
+ SIZE_T extraGuardPageRegionSize = 0;
+ if (uncommittedMemory.Protect & PAGE_GUARD) {
+ extraGuardPageRegionSize = uncommittedMemory.RegionSize;
+ VirtualQuery(static_cast<char*>(uncommittedMemory.BaseAddress) + uncommittedMemory.RegionSize, &uncommittedMemory, sizeof(uncommittedMemory));
+ }
ASSERT(uncommittedMemory.State == MEM_RESERVE);
MEMORY_BASIC_INFORMATION guardPage;
@@ -198,12 +203,12 @@ void StackBounds::initialize()
VirtualQuery(static_cast<char*>(guardPage.BaseAddress) + guardPage.RegionSize, &committedMemory, sizeof(committedMemory));
ASSERT(committedMemory.State == MEM_COMMIT);
- void* computedEnd = static_cast<char*>(m_origin) - (uncommittedMemory.RegionSize + guardPage.RegionSize + committedMemory.RegionSize);
+ void* computedEnd = static_cast<char*>(m_origin) - (uncommittedMemory.RegionSize + extraGuardPageRegionSize + guardPage.RegionSize + committedMemory.RegionSize);
ASSERT(stackOrigin.AllocationBase == uncommittedMemory.AllocationBase);
ASSERT(stackOrigin.AllocationBase == guardPage.AllocationBase);
ASSERT(stackOrigin.AllocationBase == committedMemory.AllocationBase);
- ASSERT(stackOrigin.AllocationBase == uncommittedMemory.BaseAddress);
+ ASSERT(stackOrigin.AllocationBase == static_cast<char*>(uncommittedMemory.BaseAddress) - extraGuardPageRegionSize);
ASSERT(endOfStack == computedEnd);
#endif // NDEBUG
m_bound = static_cast<char*>(endOfStack) + guardPage.RegionSize;