Ignore:
Timestamp:
Dec 27, 2002, 4:25:40 PM (23 years ago)
Author:
sandervl
Message:

Fixed stack address detection in VirtualFree

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/virtual.cpp

    r8877 r9546  
    1 /* $Id: virtual.cpp,v 1.48 2002-07-15 14:28:52 sandervl Exp $ */
     1/* $Id: virtual.cpp,v 1.49 2002-12-27 15:25:40 sandervl Exp $ */
    22
    33/*
     
    470470    {
    471471        // check if app wants to decommit stack pages -> don't allow that!
     472        // (VAC runtime uses last stack page to store some internal
     473        //  data; if freed pe/pec will crash during exit)
     474
    472475        TEB *teb = GetThreadTEB();
    473476        if(teb) {
    474             if(lpvAddress >= teb->stack_low && lpvAddress < teb->stack_top) {
     477            DWORD stacktop    = (DWORD)teb->stack_top;
     478            DWORD stackbottom = (DWORD)teb->stack_low;
     479
     480            stackbottom = stackbottom & ~0xFFFF;   //round down to 64kb boundary
     481            stacktop    = stacktop & ~0xFFF;
     482
     483            if(lpvAddress >= (PVOID)stackbottom && lpvAddress < (PVOID)stacktop) {
    475484                //pretend we did was was asked
    476485                dprintf(("WARNING: app tried to decommit stack pages; pretend success"));
Note: See TracChangeset for help on using the changeset viewer.