flat assembler
Message board for the users of flat assembler.

Index > Windows > Size of the local buffer

Author
Thread Post new topic Reply to topic
mikado3333



Joined: 31 Oct 2015
Posts: 7
Location: Russian Federation
mikado3333 28 Sep 2016, 11:52
Hello, People tell me what is the maximum size of the local buffer?

Code:

locals
bufCeh      rb 16384   
C23          dd 0
endl
 
push  ebx edi esi

    


error 0x 0000005

Directive stack does not help
Code:
format  PE GUI 4.0
stack   1048576 
entry   start
    
Post 28 Sep 2016, 11:52
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20421
Location: In your JS exploiting you and your system
revolution 28 Sep 2016, 13:35
There is no maximum local stack size except until you run out of memory, or you exceed the stack limit.

But be aware of the guard page that Windows uses to monitor stack growth and allocate new pages. You need to either statically allocate the stack by using the "stack maximum,allocated" directive or touch the stack from the top down one page at a time before trying to use it. Otherwise your program will crash with an invalid memory access.

So for your case you can use "stack 1048576,1048576" to avoid the access error.
Post 28 Sep 2016, 13:35
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 28 Sep 2016, 13:49
In documentation there is an example of stack-probing macro, "sp_prologue", that you can use to automatically create a code that touches the stack in order to grow it when entering procedure.
Post 28 Sep 2016, 13:49
View user's profile Send private message Visit poster's website Reply with quote
mikado3333



Joined: 31 Oct 2015
Posts: 7
Location: Russian Federation
mikado3333 28 Sep 2016, 18:12
Understood, thanks
Post 28 Sep 2016, 18:12
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.