InternalError: too much recursion

RESOLVED INVALID

Status

()

Core
JavaScript Engine
RESOLVED INVALID
3 years ago
3 years ago

People

(Reporter: Spandan Veggalam, Unassigned)

Tracking

43 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0
Build ID: 20150826185640

Steps to reproduce:

mozilla-central revision f61c3cc0eb8b (build with: --enable-optimize --enable-posix-nspr-emulation --enable-valgrind --enable-gczeal --enable-debug)

Shell options: --ion-eager --ion-offthread-compile=off --non-writable-jitcode --ion-check-range-analysis --ion-extra-checks --no-sse3 --no-threads -f


function g(i) {
    if (i == 0) return;
    var x = "";

    function f() {}
    eval('');
    g(i - ["this is a *&^%$# test"]);
}
g(100);



Actual results:

InternalError: too much recursion

Comment 1

3 years ago
Doesn't look like a bug to me.  |g9100)| does nothing of importance until calling |g(100 - array)|, and |100 - array| is NaN.  |g(NaN)| does nothing of importance until |g(NaN - array)|, and |NaN - array| is still |NaN|, so we recur infinitely.  What am I missing?
(Reporter)

Comment 2

3 years ago
If input started with a number(here 100), and somehow input in next iteration becomes NaN, can't we handle this differently by throwing some exception? What is the necessity to recur infinitely for NaN.
The necessity is that this is the way the language works, no?  This is no different from:

  function g() { g(); }
  g();
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.