Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-289

Passing undeclared function parameter can overwrite a local function variable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1
    • 3.2
    • None

    Description

      The following script

      var x = function(a) { var b; return b}; x(1,2)
      

      returns 2. The expected behaviour is to return null.

      As an additional safeguarding measure we may also consider restricting a function call with more supplied arguments than the number of declared parameters, since, IMO, in a majority of cases this is a bug, like where the function definition was changed but the call was not updated accordingly.

      Attachments

        Activity

          People

            henrib Henri Biestro
            dmitri_blinov Dmitri Blinov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: