Issue Details (XML | Word | Printable)

Key: CORE-2581
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Claudio Valderrama C.
Reporter: Claudio Valderrama C.
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Infinity should not escape from the engine

Created: 02/Aug/09 03:12 AM   Updated: 28/Jul/11 09:38 AM
Component/s: Engine
Affects Version/s: 2.0.0, 1.5.4, 2.0.1, 2.0.2, 2.0.3, 1.5.5, 2.1.0, 2.0.4, 2.5 Alpha 1, 2.1.1, 2.0.5, 2.1.2, 2.5 Beta 1
Fix Version/s: 2.5 RC1

Time Tracking:
Not Specified

Issue Links:
Relate
 

Planning Status: Unspecified


 Description  « Hide
Infinity and NaN should not escape from the engine. Client side tools should not see the special values. Integer overflow should be detected in the server side, too.

SQL> select 1e161/1e-161from rdb$database;

                 DIVIDE
=======================
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-Floating-point overflow. The exponent of a floating-point operation is greater than the magnitude
allowed.

This is correct detection.

SQL> set sql dialect 1;
WARNING: Client SQL dialect has been set to 1 when connecting to Database SQL dialect 3 database.
SQL> select 1e161/1e-161from rdb$database;

                 DIVIDE
=======================
               Infinity

AFAIK, dialect 1 should be protected as well. Multiplication is protected in both dialects.

We need to protect sum and subtraction as well:

SQL> set sql dialect 3;

SQL> select 1e308 + 1e308 from rdb$database;

                    ADD
=======================
               Infinity

SQL> select 1e308 - -1e308 from rdb$database;

               SUBTRACT
=======================
               Infinity


 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dmitry Yemanov added a comment - 24/Oct/09 04:01 PM
Claudio, I see commits happened for this ticket, but it's still open. Shouldn't we resolve it?

Claudio Valderrama C. added a comment - 24/Oct/09 04:53 PM
I tested now and it's solved in the FB2.5 that I have. I protected evl and fun, but I don't know how to protect floats. The test for inifinity and nan we have seems to be only for double.

Pavel Cisar added a comment - 28/Jul/11 09:38 AM
QA test added.