| Bug #16887 | Cursor causes server segfault | ||
|---|---|---|---|
| Submitted: | 29 Jan 2006 23:40 | Modified: | 15 Mar 2006 14:45 | 
| Reporter: | Ian Gulliver | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) | 
| Version: | 5.1.5-alpha-max | OS: | Linux (Debian Etch) | 
| Assigned to: | Per-Erik Martin | CPU Architecture: | Any | 
   [29 Jan 2006 23:40]
   Ian Gulliver        
  
 
   [29 Jan 2006 23:42]
   Ian Gulliver        
  Repeat SQL
Attachment: fulltext.sql.tmp (application/octet-stream, text), 2.00 KiB.
   [3 Feb 2006 15:49]
   Per-Erik Martin        
  A slightly smaller test case:
create table t3 ( c varchar(1) )|
insert into t3 values
  (' '),('.'),(';'),(','),('-'),('_'),('('),(')'),('/'),('\\')|
create procedure bug16887()
begin
  declare i int default 10;
 again:
  while i > 0 do
  begin
    declare breakchar varchar(1);
    declare done int default 0;
    declare t3_cursor cursor for select c from t3;
    declare continue handler for not found set done = 1;
    set i = i - 1;
    select i;
    if i = 3 then
      iterate again;
    end if;
    open t3_cursor;
    loop
      fetch t3_cursor into breakchar;
      if done = 1 then
        begin
          close t3_cursor;
          iterate again;
        end;
      end if;
     end loop;
   end;
   end while;
end|
call bug16887()|
 
   [15 Feb 2006 11:11]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/2638
   [3 Mar 2006 18:42]
   Konstantin Osipov        
  Okayed to push the patch intact into 5.0.19. Had some minor questions notes though, will ask to write a follow-up patch.
   [7 Mar 2006 11:33]
   Per-Erik Martin        
  Pushed to 5.0.19 release tree, and 5.0.20 main tree.
   [15 Mar 2006 14:45]
   Paul DuBois        
  Noted in 5.0.19, 5.1.8 changelogs. Cursors in stored routines could cause a server crash. (Bug #16887)
   [24 Apr 2006 7:06]
   Harish Pandia        
  Is this bug closed? We are planning to implement many functionalities in Stored Procedures and functions and hence will use cursor explicitly. Does this bug says "You can't use cursors in Stored Procedures, Functions".??
