KJS crash: var v=[]; v[0]=v; var w=""+v;

Koos Vriezen koos.vriezen at xs4all.nl
Sat Jul 6 21:11:01 BST 2002


On Sat, 6 Jul 2002, Harri Porten wrote:

> On Fri, 5 Jul 2002, Koos Vriezen wrote:
>
> > Its probably very bad javascript,
>
> I wouldn't know of any (finite) result at least.

Both bugs I send yesterday, where from my attempt to improve
org.kde.javascript.JSObject.decls javascript declarations. Must be my
bad luck day :)

> more general position. The infinite recursive call to toString() is now
> stopped with an exception (that can even be caught in the script!) at the
> arbritrary level of 1000.

Interesting, never used the try/catch in JS. Hmm, this object being
thrown, doesn't seem to show useful error information:
           try {
                var v=[]; v[0]=v; var w=""+v;
           } catch(e) {
                var s = "";
                for (var i in e)
                    s += i + "=" + e[i] + "\n";
                alert(""+ e + "\n" + s + "\n" + s.message);
           }
shows an alert box with:
  TypeError: No default value
  name=TypeError
  message=No default value
  message=No default value

  undefined

> P.S. NS 4.7 segfaulted on this one, too. Didn't try any other browser.

Mozilla makes an empty string of w.


Koos





More information about the kfm-devel mailing list