Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEGREES() does not check for overflow, allowing production of NaN & Infinity #28488

Open
kennytm opened this issue Sep 30, 2021 · 1 comment · May be fixed by #28524
Open

DEGREES() does not check for overflow, allowing production of NaN & Infinity #28488

kennytm opened this issue Sep 30, 2021 · 1 comment · May be fixed by #28524
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 component/executor severity/minor sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@kennytm
Copy link
Contributor

kennytm commented Sep 30, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

select degrees(1e308);

2. What did you expect to see? (Required)

ERROR 1690 (22003): DOUBLE value is out of range in 'degrees(1e308)'

3. What did you see instead (Required)

mysql> select degrees(1e308);
+----------------+
| degrees(1e308) |
+----------------+
|              0 |
+----------------+
1 row in set (0.07 sec)

Note that the result is not a zero, but an actual Infinity.

mysql> select degrees(1e308) - 0;
ERROR 1690 (22003): DOUBLE value is out of range in '(+Inf - 0)'

which we can proceed to produce an NaN

mysql> select degrees(1e308) % 1 - 0;
ERROR 1690 (22003): DOUBLE value is out of range in '(NaN - 0)'

4. What is your TiDB version? (Required)

Release Version: v5.2.0
Edition: Community
Git Commit Hash: 05d2210647d6a1503a8d772477e43b14a024f609
Git Branch: heads/refs/tags/v5.2.0
UTC Build Time: 2021-08-27 05:57:10
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

&&

Release Version: v5.3.0-alpha-248-g091ae3bde
Edition: Community
Git Commit Hash: 091ae3bde0a54b126f2f2ed275dd20b0986d74d3
Git Branch: master
UTC Build Time: 2021-09-30 02:39:24
GoVersion: go1.17
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@kennytm kennytm added type/bug The issue is confirmed as a bug. component/executor affects-5.2 This bug affects 5.2.x versions. labels Sep 30, 2021
@kennytm kennytm added affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. labels Sep 30, 2021
@jebter jebter added the sig/execution SIG execution label Dec 6, 2021
@jebter jebter added affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. labels Apr 11, 2022
@zanmato1984
Copy link
Contributor

Adjusting severity to minor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 component/executor severity/minor sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants