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

mysql tester crashes when selecting truncated incorrect DECIMAL value #44

Open
espresso98 opened this issue Dec 18, 2021 · 0 comments
Open

Comments

@espresso98
Copy link

espresso98 commented Dec 18, 2021

When selecting a truncated incorrect value, mysql tester crashes.

select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 as x;
select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x;
create table t1 (s varchar(100));
insert into t1 values (0.00000000010000000000000000364321973154977415791655470655996396089904010295867919921875);
drop table t1;
CREATE TABLE t2 (i DECIMAL (30,27));
INSERT INTO t2 VALUES (6.8926822182388193469056146);
DROP TABLE t2;

SET sql_mode="";
CREATE TABLE t (a int);
INSERT INTO t() VALUES(),(),(),();
SELECT
lag(1,96,
-66812354762147309124165421419678600705366236356475480.892682218238819346905614650696)
over()
FROM t;

DROP TABLE t;
SET sql_mode = default;
create table t1 (c1 decimal(64));
insert into t1 values(
89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
--error ER_DATA_OUT_OF_RANGE
insert into t1 values(
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 *
99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
insert into t1 values(1e100);
select * from t1;
drop table t1;

Output is

panic: This branch is not implemented. This is because you are trying to test something specific to TiDB's MyDecimal implementation. It is recommended to do this in TiDB repository.

goroutine 7 [running]:
github.com/pingcap/tidb/parser/test_driver.fixWordCntError(...)
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/test_driver/test_driver_mydecimal.go:36
github.com/pingcap/tidb/parser/test_driver.(*MyDecimal).FromString(0x30, {0xc00042e000, 0x82, 0xc000056d80})
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/test_driver/test_driver_mydecimal.go:226 +0x3db
github.com/pingcap/tidb/parser/test_driver.init.0.func1({0xc0000ee127, 0x82})
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/test_driver/test_driver.go:34 +0x58
github.com/pingcap/tidb/parser.toDecimal({0x144ed58, 0xc000096048}, 0xc0000961a0, {0xc0000ee127, 0x1})
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/yy_parser.go:274 +0x3f
github.com/pingcap/tidb/parser.toInt({0x144ed58, 0xc000096048}, 0xc0000961a0, {0xc0000ee127, 0x82})
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/yy_parser.go:258 +0x150
github.com/pingcap/tidb/parser.(*Scanner).Lex(0xc000096048, 0xc0000961a0)
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/lexer.go:218 +0x3f3
github.com/pingcap/tidb/parser.yylex1({0x144ed58, 0xc000096048}, 0xc0000961a0)
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/parser.go:11023 +0x4a
github.com/pingcap/tidb/parser.yyParse({0x144ed58, 0xc000096048}, 0xc000096000)
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/parser.go:11077 +0x79ef7
github.com/pingcap/tidb/parser.(*Parser).ParseSQL(0xc000096000, {0xc0000ee120, 0x8f}, {0xc0001b1bd0, 0x2, 0x377})
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/yy_parser.go:154 +0x2b3
github.com/pingcap/tidb/parser.(*Parser).Parse(...)
        /Users/youracho/go/pkg/mod/github.com/pingcap/tidb/[email protected]/yy_parser.go:174
main.(*tester).execute(0xc000090000, {{0xc0000ee120, 0x6}, {0xc0000ee120, 0x8f}, 0x37c, 0x2})
        /Users/youracho/go/pkg/mod/github.com/pingcap/[email protected]/src/main.go:638 +0x11b
main.(*tester).Run(0xc000090000)
        /Users/youracho/go/pkg/mod/github.com/pingcap/[email protected]/src/main.go:318 +0x645
main.testBatch.Run({0xc00000c1e0, 0x1, 0x0})
        /Users/youracho/go/pkg/mod/github.com/pingcap/[email protected]/src/main.go:948 +0xbd
created by main.executeTests
        /Users/youracho/go/pkg/mod/github.com/pingcap/[email protected]/src/main.go:978 +0x1b3
tidb-server(PID: 35799) stopped
@espresso98 espresso98 changed the title mysql tester crashes when to select truncated incorrect DECIMAL value mysql tester crashes when selecting truncated incorrect DECIMAL value Dec 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant