Bug #5274 Stored procedure crash if length of CHAR variable too great
Submitted: 28 Aug 2004 1:30 Modified: 6 Apr 2007 15:40
Reporter: Peter Gulutzan Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Alexander Nozdrin CPU Architecture:Any

[28 Aug 2004 1:30] Peter Gulutzan
Description:
In a stored procedure I have a loop that causes the length of a CHAR variable to increase 
till it's too great to handle. I hope for an error return. Instead I get a crash. 
 

How to repeat:
mysql> delimiter // 
mysql> create function f51 (param1 char) returns char return concat(param1,param1)// 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> create function f52 () returns char begin declare v1 int default 0; declare v2 char 
default 'x'; while v1 < 30 do set v1 = v1 + 1; set v2 = f51(v2); end while; return v2; end;// 
Query OK, 0 rows affected (0.01 sec) 
 
mysql> select f52()// 
ERROR 2013 (HY000): Lost connection to MySQL server during query
[28 Aug 2004 6:25] MySQL Verification Team
Verified against latest BK source. Thank you for the bug report.
[10 Sep 2004 15:46] Per-Erik Martin
After the latest merge with 4.1 it no longer crashes - instead it's returning NULL
which isn't right either...
[20 Apr 2005 10:17] Per-Erik Martin
This now "works", in that it's not crashing. Instead NULL is returned and
a truncation warning is set. This is due to the limitation that "select" can't return
an error.
(See also the related BUG#9856)
[6 Apr 2007 15:40] Alexander Nozdrin
It does not repeat anymore.
Version: 5.0.40.
[12 Apr 2007 15:43] 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/24394

ChangeSet@1.2438, 2007-04-12 19:42:45+04:00, anozdrin@ibm. +2 -0
  Test case for BUG#5274: Stored procedure crash if length
  of CHAR variable too great.
[23 Apr 2007 7:29] Bugs System
Pushed into 5.1.18-beta
[23 Apr 2007 7:30] Bugs System
Pushed into 5.0.42