Bug #726 memory ovverun of key_fields
Submitted: 25 Jun 2003 17:28 Modified: 29 Jun 2003 6:20
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1 OS:Any (any)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[25 Jun 2003 17:28] Oleksandr Byelkin
Description:
dropping  thd->cond_count by outer SELECT in setup_conds may lead to memory 
overrun in inner SELECT 

How to repeat:
CREATE TABLE CMFOLDERS 
( 
FOLDERID VARCHAR(32)BINARY NOT NULL 
, FOLDERNAME VARCHAR(255)BINARY NOT NULL 
, CREATOR VARCHAR(255)BINARY 
, CREATED TIMESTAMP NOT NULL 
, DESCRIPTION VARCHAR(255)BINARY 
, FOLDERTYPE INTEGER NOT NULL 
, MODIFIED TIMESTAMP 
, MODIFIER VARCHAR(255)BINARY 
, FOLDERSIZE INTEGER NOT NULL 
, PARENTID VARCHAR(32)BINARY 
, REPID VARCHAR(32)BINARY 
, ORIGINATOR INTEGER 
 
, PRIMARY KEY ( FOLDERID ) 
) TYPE=InnoDB; 
INSERT INTO CMFOLDERS VALUES("0c9aab05b15048c59bc35c8461507deb", "System", 
"System", "2003-06-05 16:30:00", "The system content repository folder.", "3", 
"2003-06-05 16:30:00", "System", "0", NULL, 
"9c9aab05b15048c59bc35c8461507deb", "1"); 
INSERT INTO CMFOLDERS VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", 
"System", "2003-06-09 10:52:02", "The default content repository folder.", 
"3", "2003-06-05 16:30:00", "System", "0", NULL, 
"03eea05112b845949f3fd03278b5fe43", "1"); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791724315444553544200", 
"AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", 
"2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", 
"03eea05112b845949f3fd03278b5fe43", NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad07919e1963444553544200", 
"NewDestDirectory", "admin", "2003-06-09 10:51:28", "Adding new directory", 
"128", "2003-06-09 10:51:28", "admin", "0", 
"2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad07919fe525444553544200", 
"SubDestDirectory", "admin", "2003-06-09 10:51:28", "Adding new directory", 
"128", "2003-06-09 10:51:28", "admin", "0", 
"c373e9f5ad07919e1963444553544200", "03eea05112b845949f3fd03278b5fe43", NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791a0dab5444553544200", "Level1", 
"admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", 
"0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791a14669444553544200", "Level2", 
"admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", 
"0", "c373e9f5ad0791a0dab5444553544200", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791a23c0e444553544200", "Level3", 
"admin", "2003-06-09 10:51:29", NULL, "0", "2003-06-09 10:51:29", "admin", 
"0", "c373e9f5ad0791a14669444553544200", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791a6b11f444553544200", "Dir1", 
"admin", "2003-06-09 10:51:30", NULL, "0", "2003-06-09 10:51:30", "admin", 
"0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791a897d6444553544200", "Dir2", 
"admin", "2003-06-09 10:51:30", NULL, "0", "2003-06-09 10:51:30", "admin", 
"0", "c373e9f5ad0791a6b11f444553544200", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791a9a063444553544200", 
"NewDestDirectory", "admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 
10:51:31", "admin", "0", "c373e9f5ad0791a897d6444553544200", 
"03eea05112b845949f3fd03278b5fe43", NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791aa73e3444553544200", "LevelA", 
"admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", 
"0", "c373e9f5ad0791a0dab5444553544200", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791ab034b444553544200", "LevelB", 
"admin", "2003-06-09 10:51:31", NULL, "0", "2003-06-09 10:51:31", "admin", 
"0", "c373e9f5ad0791aa73e3444553544200", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791ac7311444553544200", "LevelC", 
"admin", "2003-06-09 10:51:32", NULL, "0", "2003-06-09 10:51:32", "admin", 
"0", "c373e9f5ad0791ab034b444553544200", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791ad66cf444553544200", "test2", 
"admin", "2003-06-09 10:51:32", NULL, "0", "2003-06-09 10:51:32", "admin", 
"0", "c373e9f5ad0791724315444553544200", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791aebd87444553544200", "test3", 
"admin", "2003-06-09 10:51:33", NULL, "0", "2003-06-09 10:51:33", "admin", 
"0", "c373e9f5ad0791ad66cf444553544200", "03eea05112b845949f3fd03278b5fe43", 
NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0791dbaac4444553544200", "Special Caf 
-L? Folder", "admin", "2003-06-09 10:51:43", "test folder names with special 
chars", "0", "2003-06-09 10:51:43", "admin", "0", 
"2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL); 
-A 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0796bf913f444553544200", 
"CopiedFolder", "admin", "2003-06-09 11:09:05", "Movie Reviews", "0", 
"2003-06-09 11:09:05", "admin", "0", "c373e9f5ad0791a23c0e444553544200", 
"03eea05112b845949f3fd03278b5fe43", NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0796c0eca4444553544200", "Movie 
Reviews", "admin", "2003-06-09 11:09:13", "Movie Reviews", "0", "2003-06-09 
11:09:13", "admin", "33", "c373e9f5ad0796bf913f444553544200", 
"03eea05112b845949f3fd03278b5fe43", NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad0796d9b895444553544200", 
"NewBookFolder", "admin", "2003-06-09 11:12:41", "NewBooks - folder", "0", 
"2003-06-09 11:12:41", "admin", "0", "c373e9f5ad0796c0eca4444553544200", 
"03eea05112b845949f3fd03278b5fe43", NULL); 
INSERT INTO CMFOLDERS VALUES("c373e9f5ad079b4c9355444553544200", 
"CopiedFolder", "admin", "2003-06-09 11:26:34", "Movie Reviews", "0", 
"2003-06-09 11:26:34", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", 
"03eea05112b845949f3fd03278b5fe43", NULL); 
 
CREATE INDEX FFOLDERID_IDX ON CMFOLDERS (FOLDERID); 
CREATE INDEX CMFLDRPARNT_IDX ON CMFOLDERS (PARENTID); 
 
 
SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT CMFOLDERS.FOLDERID FROM 
CMFOLDERS WHERE CMFOLDERS.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND 
CMFOLDERS.FOLDERNAME = 'Level1'); 

Suggested fix:
move thd->cond_count to thd->current_select->cond_count
[26 Jun 2003 1:19] Oleksandr Byelkin
ChangeSet 
  1.1571 03/06/26 11:09:11 bell@sanja.is.com.ua +10 -0
[29 Jun 2003 6:20] Oleksandr Byelkin
fixed