用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.5 KiB

#
# Bug #20087571: 5.7 EASILY HITS ERROR 1436 (HY000):
# THREAD STACK OVERRUN ERRORS ON MANY EXPR'S
#
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
67108864
Warnings:
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
SET @@global.max_allowed_packet=16999424;
CREATE TABLE t1 (a INT UNSIGNED, b INT UNSIGNED, PRIMARY KEY (a, b))
ENGINE=INNODB;
CREATE PROCEDURE p1(p_min_terms INT UNSIGNED, p_max_terms INT UNSIGNED, p_incr
INT UNSIGNED)
begin
DECLARE v_sql LONGTEXT CHARSET LATIN1;
DECLARE i INT UNSIGNED DEFAULT 1;
SET i:=greatest(1, p_min_terms);
REPEAT
SET @terms:=f1(i);
SET v_sql:=concat("delete from t1 where ",@terms);
SET @t:=v_sql;
SELECT i AS 'numterms', length(@t) AS 'query lengt', p_incr AS 'increment';
PREPARE s FROM @t;
EXECUTE s;
DEALLOCATE PREPARE s;
SET i:=i + p_incr;
UNTIL i > p_max_terms end repeat;
END|
CREATE FUNCTION f1(p_numterms INT UNSIGNED) RETURNS LONGTEXT
BEGIN
DECLARE ret LONGTEXT DEFAULT '';
SET ret:=CONCAT(REPEAT("(a=1 and b=2) or ",GREATEST(p_numterms-1,1)),"(a=2 and b=1)");
RETURN RET;
END|
CALL p1(950000, 950000, 100000);
numterms query lengt increment
950000 16150017 100000
SELECT LENGTH(@terms);
LENGTH(@terms)
16149996
SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet
16999424
DROP FUNCTION f1;
DROP PROCEDURE p1;
DROP TABLE t1;
SET @@global.max_allowed_packet:= @tmp_max;
#