Author: fireball
Date: Mon Jul 7 04:24:10 2008
New Revision: 34351
URL:
http://svn.reactos.org/svn/reactos?rev=34351&view=rev
Log:
- Initialize TLS expansion bitmap properly (fixes accessing uninitialized memory when all
regular TEB slots for TLS data are occupied).
Modified:
trunk/reactos/dll/ntdll/ldr/startup.c
Modified: trunk/reactos/dll/ntdll/ldr/startup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/startup.c?re…
==============================================================================
--- trunk/reactos/dll/ntdll/ldr/startup.c [iso-8859-1] (original)
+++ trunk/reactos/dll/ntdll/ldr/startup.c [iso-8859-1] Mon Jul 7 04:24:10 2008
@@ -27,6 +27,7 @@
static RTL_CRITICAL_SECTION PebLock;
static RTL_CRITICAL_SECTION LoaderLock;
static RTL_BITMAP TlsBitMap;
+static RTL_BITMAP TlsExpansionBitMap;
PLDR_DATA_TABLE_ENTRY ExeModule;
NTSTATUS LdrpAttachThread (VOID);
@@ -333,11 +334,16 @@
Peb->FastPebLockRoutine = (PPEBLOCKROUTINE)RtlEnterCriticalSection;
Peb->FastPebUnlockRoutine = (PPEBLOCKROUTINE)RtlLeaveCriticalSection;
- /* initialize tls bitmap */
+ /* initialize tls bitmaps */
RtlInitializeBitMap (&TlsBitMap,
Peb->TlsBitmapBits,
TLS_MINIMUM_AVAILABLE);
+ RtlInitializeBitMap (&TlsExpansionBitMap,
+ Peb->TlsExpansionBitmapBits,
+ TLS_EXPANSION_SLOTS);
+
Peb->TlsBitmap = &TlsBitMap;
+ Peb->TlsExpansionBitmap = &TlsExpansionBitMap;
Peb->TlsExpansionCounter = TLS_MINIMUM_AVAILABLE;
/* Initialize table of callbacks for the kernel. */