From: anton@mips.complang.tuwien.ac.at   
      
   Krishna Myneni writes:   
   >On 3/2/24 10:08, Krishna Myneni wrote:   
   >> === Gforth example ===   
   >> : rt1 recurse ; ok   
   >> rt1   
   >> *the terminal*:2:1: error: Return stack overflow   
   >> >>>rt1<<<   
   >> === end example ===   
   >>   
   >   
   >To be clear, if you try to fill up the fp or data stack, as with your   
   >rt1 example, kForth does give a segfault (and hence is susceptible to an   
   >exploit), while Gforth still gives the same error.   
      
   In Gforth on a Unix system, Unix produces a SIGSEGV when a stack runs   
   into a guard page. The signal handler then looks at the offending   
   address, and guesses that an access close to the bottom of a stack is   
   an underflow of that stack, and correspondingly for accesses close to   
   the top of a stack. This can be seen as follows:   
      
   With the gforth engine with the FP stack being empty:   
      
   fp@ 32769 - c@   
   *the terminal*:3:13: error: Floating-point stack overflow   
   fp@ 32769 - >>>c@<<<   
   fp@ 1+ c@   
   *the terminal*:4:8: error: Floating-point stack underflow   
   fp@ 1+ >>>c@<<<   
      
   - anton   
   --   
   M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html   
   comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html   
    New standard: https://forth-standard.org/   
    EuroForth 2023: https://euro.theforth.net/2023   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|