Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.0.2, 5.5.31, 5.3.12
-
None
-
None
Description
strings/decimal.c:1450: decimal_bin_size: Assertion `scale <= precision' failed
|
1442 int decimal_bin_size(int precision, int scale)
|
1443 {
|
1444 int intg=precision-scale,
|
1445 intg0=intg/DIG_PER_DEC1, frac0=scale/DIG_PER_DEC1,
|
1446 intg0x=intg-intg0*DIG_PER_DEC1, frac0x=scale-frac0*DIG_PER_DEC1;
|
1447
|
1448 DBUG_ASSERT(scale >= 0);
|
1449 DBUG_ASSERT(precision > 0);
|
1450 DBUG_ASSERT(scale <= precision);
|
1451 return intg0*sizeof(dec1)+dig2bytes[intg0x]+
|
1452 frac0*sizeof(dec1)+dig2bytes[frac0x];
|
#4 0x00007f0c09236425 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
|
#5 0x00007f0c09239b8b in __GI_abort () at abort.c:91
|
#6 0x00007f0c0922f0ee in __assert_fail_base (fmt=<optimized out>, assertion=0xfa1873 "scale <= precision", file=0xfa15e0 "/home/elenst/bzr/5.5/strings/decimal.c", line=<optimized out>, function=<optimized out>) at assert.c:94
|
#7 0x00007f0c0922f192 in __GI___assert_fail (assertion=0xfa1873 "scale <= precision", file=0xfa15e0 "/home/elenst/bzr/5.5/strings/decimal.c", line=1450, function=0xfa1a60 "decimal_bin_size") at assert.c:103
|
#8 0x0000000000cf36d8 in decimal_bin_size (precision=19, scale=30) at /home/elenst/bzr/5.5/strings/decimal.c:1450
|
#9 0x0000000000679cf3 in my_decimal_get_binary_size (precision=19, scale=30) at /home/elenst/bzr/5.5/sql/my_decimal.h:263
|
#10 0x0000000000670aa7 in calc_group_buffer (join=0x7f0bf4008240, group=0x7f0bf4008148) at /home/elenst/bzr/5.5/sql/sql_select.cc:20358
|
#11 0x0000000000641c12 in JOIN::optimize (this=0x7f0bf4008240) at /home/elenst/bzr/5.5/sql/sql_select.cc:1564
|
#12 0x0000000000646f55 in mysql_select (thd=0x3d8a0b0, rref_pointer_array=0x3d8d0b8, tables=0x7f0bf4007700, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f0bf4008148, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f0bf4008220, unit=0x3d8c788, select_lex=0x3d8ce60) at /home/elenst/bzr/5.5/sql/sql_select.cc:3040
|
#13 0x000000000063db9e in handle_select (thd=0x3d8a0b0, lex=0x3d8c6d8, result=0x7f0bf4008220, setup_tables_done_option=0) at /home/elenst/bzr/5.5/sql/sql_select.cc:318
|
#14 0x000000000061691d in execute_sqlcom_select (thd=0x3d8a0b0, all_tables=0x7f0bf4007700) at /home/elenst/bzr/5.5/sql/sql_parse.cc:4642
|
#15 0x000000000060f36c in mysql_execute_command (thd=0x3d8a0b0) at /home/elenst/bzr/5.5/sql/sql_parse.cc:2196
|
#16 0x00000000006191bc in mysql_parse (thd=0x3d8a0b0, rawbuf=0x7f0bf40074c8 "SELECT a FROM t1 GROUP BY TIMEDIFF( '2004-06-12', a ) * 1", length=57, parser_state=0x7f0bfe912500) at /home/elenst/bzr/5.5/sql/sql_parse.cc:5760
|
#17 0x000000000060c8ac in dispatch_command (command=COM_QUERY, thd=0x3d8a0b0, packet=0x3e7eae1 "SELECT a FROM t1 GROUP BY TIMEDIFF( '2004-06-12', a ) * 1", packet_length=57) at /home/elenst/bzr/5.5/sql/sql_parse.cc:1068
|
#18 0x000000000060baed in do_command (thd=0x3d8a0b0) at /home/elenst/bzr/5.5/sql/sql_parse.cc:794
|
#19 0x0000000000711fdd in do_handle_one_connection (thd_arg=0x3d8a0b0) at /home/elenst/bzr/5.5/sql/sql_connect.cc:1266
|
#20 0x00000000007119c4 in handle_one_connection (arg=0x3d8a0b0) at /home/elenst/bzr/5.5/sql/sql_connect.cc:1181
|
#21 0x000000000096004c in pfs_spawn_thread (arg=0x3e17390) at /home/elenst/bzr/5.5/storage/perfschema/pfs.cc:1015
|
#22 0x00007f0c09fffe9a in start_thread (arg=0x7f0bfe913700) at pthread_create.c:308
|
#23 0x00007f0c092f3cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
|
bzr version-info
revision-id: wlad@montyprogram.com-20130509212557-5cdelkdvf7t61062
|
date: 2013-05-09 23:25:57 +0200
|
build-date: 2013-05-11 17:48:44 +0400
|
revno: 3756
|
branch-nick: 5.5
|
Test case:
CREATE TABLE t1 (a DATE) ENGINE=MyISAM; |
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); |
SELECT a FROM t1 GROUP BY TIMEDIFF( '2004-06-12', a ) * 1; |
Setting to Minor because the query is rather silly
Another test case that crashes the server:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a DATE) ENGINE=MyISAM; |
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); |
SELECT a FROM t1 GROUP BY ADDTIME(a,'10')*1; |
So does this one:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a DATE) ENGINE=MyISAM; |
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); |
SELECT * FROM t1 GROUP BY SEC_TO_TIME(concat(a,'10'))*1; |
So does this one:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a DATE) ENGINE=MyISAM; |
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); |
SELECT * FROM t1 GROUP BY ADDTIME(timestamp('2001-01-01 00:00:00'),CAST(a AS SIGNED)&0xF)*1; |
So does this one:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a DATE) ENGINE=MyISAM; |
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); |
SELECT * FROM t1 GROUP BY STR_TO_DATE(a,concat('%Y-%m-%d.%f',if(rand(),'','')))*1; |
More crashing tests:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a DATE) ENGINE=MyISAM; |
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); |
SELECT * FROM t1 GROUP BY FROM_UNIXTIME(concat(a,'10'))*1; |
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a DATE) ENGINE=MyISAM; |
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); |
SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10')))*1; |
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
|
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
|
SELECT * FROM t1 GROUP BY (-FROM_UNIXTIME(concat(a,'10')));
|
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
|
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
|
SELECT * FROM t1 GROUP BY ABS(FROM_UNIXTIME(concat(a,'10')));
|
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a DATE) ENGINE=MyISAM;
|
INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23');
|
SELECT * FROM t1 GROUP BY @a:=(FROM_UNIXTIME(concat(a,'10'))*1);
|