1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Update extension ext/misc/totext.c to avoid both ubsan warnings and dubious real->integer conversions.

FossilOrigin-Name: c626aa108a7a30cef54af8d93ac9e45749568ed38e4e06623a6bad6b4bf6e8ec
This commit is contained in:
dan
2024-01-05 15:53:58 +00:00
parent 76da0dcbc4
commit 1cfc040bba
4 changed files with 34 additions and 18 deletions

View File

@@ -92,7 +92,7 @@ do_execsql_test func4-1.22 {
} {{}}
do_execsql_test func4-1.23 {
SELECT tointeger(-9223372036854775808 - 1);
} {-9223372036854775808}
} {{}}
do_execsql_test func4-1.24 {
SELECT tointeger(-9223372036854775808);
} {-9223372036854775808}
@@ -269,7 +269,7 @@ ifcapable floatingpoint {
} {-9.223372036854776e+18}
do_execsql_test func4-2.24 {
SELECT toreal(-9223372036854775808);
} {-9.223372036854776e+18}
} {{}}
if {$highPrecision(2)} {
do_execsql_test func4-2.25 {
SELECT toreal(-9223372036854775808 + 1);
@@ -277,7 +277,7 @@ ifcapable floatingpoint {
}
do_execsql_test func4-2.26 {
SELECT toreal(-9223372036854775807 - 1);
} {-9.223372036854776e+18}
} {{}}
if {$highPrecision(2)} {
do_execsql_test func4-2.27 {
SELECT toreal(-9223372036854775807);
@@ -461,7 +461,7 @@ ifcapable check {
catchsql {
INSERT INTO t1 (x) VALUES ('-9223372036854775809');
}
} {0 {}}
} {1 {CHECK constraint failed: tointeger(x) IS NOT NULL}}
if {$highPrecision(1)} {
do_test func4-3.19 {
catchsql {
@@ -573,10 +573,10 @@ ifcapable floatingpoint {
} {1}
do_execsql_test func4-5.6 {
SELECT tointeger(toreal(-9223372036854775808 - 1));
} {-9223372036854775808}
} {{}}
do_execsql_test func4-5.7 {
SELECT tointeger(toreal(-9223372036854775808));
} {-9223372036854775808}
} {{}}
if {$highPrecision(2)} {
do_execsql_test func4-5.8 {
SELECT tointeger(toreal(-9223372036854775808 + 1));