Skip to content

typed variable declaration should not stomp on timer variables #246

Closed

Description

@x87

#32
Skip TIMERA and TIMERB when allocating the next index It happens e.g. when using a lot of custom variables in a mission code.

Activity

  1. added
    type:bug
    priority:p2
    on Aug 31, 2023
  2. added this to the v3.9.0 milestone on Aug 31, 2023
  3. x87 commented on Sep 2, 2023

    @x87
    CollaboratorAuthor

    Managing variable buffer overflow (too many local vars).

    Precondition:

    • If this is GTA 3 or GTA VC
      • limit number of available indexes to 16 (from 0@ to 15@)
      • 16@ and 17@ are reserved for timers.
    • if this is SA
      • if this is a regular script
        • limit number of available indexes to 32 (from 0@ to 31@)
        • 32@ and 33@ are reserved for timers.
      • if this is a mission script
        • limit number of available indexes to 990 (from 34@ to 1023@)
        • 32@ and 33@ are reserved for timers.
    • if this is SA Mobile
      • if this is a regular script
        • limit number of available indexes to 40 (from 0@ to 39@)
        • 40@ and 41@ are reserved for timers.
      • if this is a mission script
        • limit number of available indexes to 982 (from 42@ to 1023@)
        • 40@ and 41@ are reserved for timers.
    • If this is LCS or VCS
      • limit number of available indexes to 96 (from 0@ to 95@)
      • -1@ and -2@ are reserved for timers.

    Validation rule:

    • if Ranges check is ON
      • and next requested index overruns the buffer (see ranges above)
      • OR the array size is larger than the number of remaining indexes
        • throw an error
  4. x87 commented on Sep 2, 2023

    @x87
    CollaboratorAuthor

    this validation will be annoying without #145 . however current behavior is even worse, as new declared variables go beyond the limit without any warning (35@, 36@, etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:p2scope:compilertype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions