Skip to content

Instantly share code, notes, and snippets.

@chfast
Last active December 19, 2016 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chfast/deb14466aa92dd825e32bedd46a6eb19 to your computer and use it in GitHub Desktop.
Save chfast/deb14466aa92dd825e32bedd46a6eb19 to your computer and use it in GitHub Desktop.
  1. Extend BEGINSUB specification with third parameter max_frame_size -- the maximum size of the stack frame the subroutine is allowed to use.

  2. In the Validity section, after condition 6 add new conditions:

    6a. For JUMPSUB and JUMPSUBV the frame size + the max_frame_size of the BEGINSUB(s) to jump to is not greater than 1024.

    6b. The frame size is not greater than the max_frame_size of the enclosing subroutine.

  3. In the Validating subroutines section, after

    // check for stack overflow
    if SP > 1024
        return false
    

    add

    // check for exiding the max_frame_size
    if SP + max_frame_size(return_pc) > 1024
        return false
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment