Commit 3141a68
committed
MDEV-33534 UBSAN: Negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_double_round from sql/item_func.cc|
The negation in this line: ulonglong abs_dec= dec_negative ? -dec : dec; did not take into account that 'dec' can be the smallest possible signed negative value -9223372036854775808. Its negation is an operation with an undefined behavior. Fixing the code to use Longlong_hybrid, which implements a safe method to get an absolute value.1 parent 3d41747 commit 3141a68
File tree
3 files changed
+37
-10
lines changed- mysql-test/main
- sql
3 files changed
+37
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3617 | 3617 | | |
3618 | 3618 | | |
3619 | 3619 | | |
| 3620 | + | |
| 3621 | + | |
| 3622 | + | |
| 3623 | + | |
| 3624 | + | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
| 3630 | + | |
| 3631 | + | |
| 3632 | + | |
| 3633 | + | |
| 3634 | + | |
3620 | 3635 | | |
3621 | 3636 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1929 | 1929 | | |
1930 | 1930 | | |
1931 | 1931 | | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
1932 | 1942 | | |
1933 | 1943 | | |
1934 | 1944 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2638 | 2638 | | |
2639 | 2639 | | |
2640 | 2640 | | |
2641 | | - | |
| 2641 | + | |
2642 | 2642 | | |
2643 | 2643 | | |
2644 | 2644 | | |
2645 | | - | |
2646 | | - | |
| 2645 | + | |
| 2646 | + | |
2647 | 2647 | | |
2648 | 2648 | | |
2649 | 2649 | | |
| |||
2658 | 2658 | | |
2659 | 2659 | | |
2660 | 2660 | | |
2661 | | - | |
| 2661 | + | |
2662 | 2662 | | |
2663 | 2663 | | |
2664 | | - | |
2665 | | - | |
2666 | | - | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
2667 | 2669 | | |
2668 | 2670 | | |
2669 | 2671 | | |
2670 | 2672 | | |
2671 | | - | |
| 2673 | + | |
2672 | 2674 | | |
2673 | | - | |
| 2675 | + | |
2674 | 2676 | | |
2675 | 2677 | | |
2676 | | - | |
| 2678 | + | |
2677 | 2679 | | |
2678 | 2680 | | |
2679 | 2681 | | |
| |||
0 commit comments