Bug 75830

Summary: konqueror crashes when executing Number.NaN.toString(16)
Product: [Applications] konqueror Reporter: Eugen D <eugen>
Component: kjsAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Eugen D 2004-02-22 14:51:58 UTC
Version:           3.2.0 (using KDE 3.2.0, SuSE)
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:          Linux (i586) release 2.4.21-166-default

This is a minimal (non-sense) example for a crash which occurred in my real-life-application.

Of course it does not make sense to "toString(16)" NaN... but konqzeror shouldn't crash.

BTW: Number.NaN.toString() does NOT crash konqui
Comment 1 Harri Porten 2004-02-22 19:32:09 UTC
CVS commit by porten: 

fixed crash if toString() is called on NaN or Inf with a radix != 10.

CCMAIL: 75830-done@bugs.kde.org


  M +8 -0      ChangeLog   1.40
  M +2 -0      number_object.cpp   1.40


--- kdelibs/kjs/number_object.cpp  #1.39:1.40
@@ -159,4 +159,6 @@ Value NumberProtoFuncImp::call(ExecState
       char s[2048 + 3];
       double x = v.toNumber(exec);
+      if (isNaN(x) || isInf(x))
+        return String(UString::from(x));
       // apply algorithm on absolute value. add sign later.
       bool neg = false;

--- kdelibs/kjs/ChangeLog  #1.39:1.40
@@ -1,2 +1,10 @@
+2004-02-22  Harri Porten  <porten@kde.org>
+
+        * number_object.cpp: fixed crash if toString() is called on NaN
+        or Inf with a radix != 10.
+
+        * error_object.cpp: Error constructors are of [[Class]] Function
+        while Error instances are of [[Class]] Error.
+
 2004-02-21  Harri Porten  <porten@kde.org>