PAC-E017 · pac-function-wrong-arity

PAC helper called with the wrong number of arguments

high · Errors and robustness

A built-in PAC helper is called with too few or too many arguments. In the browsers missing arguments are undefined, which makes the helper return false or an unexpected value for every host. Windows (WinHTTP) raises an error for many such calls, which ends the script.

Why it matters

A wrong argument count is not caught when the file is loaded. In the browsers the helpers are plain JavaScript functions: dnsDomainIs(host) compares against undefined and shExpMatch(host, "a", "b") ignores the third argument, so the branch is silently wrong. isInNet(host, "10.0.0.0") depends on the engine: Chrome, Edge and Firefox return false, while pactester (pacparser) and Windows (WinHTTP) throw an error that ends the whole evaluation (lab, 2026-10-11). In the same lab run Windows also threw for an extra argument, for example isPlainHostName("a", "b") and isInNet with four arguments, and for a missing one, for example isPlainHostName(). Either way the rule does not do what it says.

How to fix

Check the helper signature (isInNet needs host, network, mask; dnsDomainIs and shExpMatch need host and pattern).

Examples

Bad

function FindProxyForURL(url, host) {
  if (isInNet(host, "10.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open bad example in checker

Good

function FindProxyForURL(url, host) {
  if (isInNet(host, "10.0.0.0", "255.0.0.0")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
Open good example in checker

Engine behaviour

EngineBehaviourSource
winhttpisPlainHostName, isInNet and weekdayRange raised an error that ends the script when an argument was missing, extra or null, for example isPlainHostName(), isPlainHostName("a", "b"), isInNet with two or four arguments and weekdayRange(null). dateRange() and timeRange() without arguments returned false.lab, verified 2026-10-11

Source: code = read in the engine's source, doc = vendor documentation, lab = observed in a lab run, expert = practitioner knowledge, not yet verified.

Related rules

References

Last updated: