mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug #30639: limit offset,rowcount wraps when rowcount >= 2^32 in windows
The parser uses ulonglong to store the LIMIT number. This number then is stored into a variable of type ha_rows. ha_rows is either 4 or 8 byte depending on the BIG_TABLES define from config.h So an overflow may occur (and LIMIT becomes zero) while storing an ulonglong value in ha_rows. Fixed by : 1. Using the maximum possible value for ha_rows on overflow 2. Defining BIG_TABLES for the windows builds (to match the others)
This commit is contained in:
@ -4048,3 +4048,20 @@ Level Code Message
|
||||
Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
create table t1(a INT, KEY (a));
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
SELECT a FROM t1 ORDER BY a LIMIT 2;
|
||||
a
|
||||
1
|
||||
2
|
||||
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296;
|
||||
a
|
||||
3
|
||||
4
|
||||
5
|
||||
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297;
|
||||
a
|
||||
3
|
||||
4
|
||||
5
|
||||
DROP TABLE t1;
|
||||
|
@ -3450,3 +3450,13 @@ SHOW WARNINGS;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
# Bug #30639: limit offset,rowcount wraps when rowcount >= 2^32 in windows
|
||||
#
|
||||
create table t1(a INT, KEY (a));
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
SELECT a FROM t1 ORDER BY a LIMIT 2;
|
||||
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296;
|
||||
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297;
|
||||
DROP TABLE t1;
|
||||
|
Reference in New Issue
Block a user