Bug 75830 - konqueror crashes when executing Number.NaN.toString(16)
Summary: konqueror crashes when executing Number.NaN.toString(16)
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: kjs (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-22 14:51 UTC by Eugen D
Modified: 2004-02-22 19:32 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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>