Bug #628 Memory overrun with concat("$",format(col_m,2))
Submitted: 10 Jun 2003 17:44 Modified: 3 Jul 2003 6:47
Reporter: Miguel Solorzano Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:3.23.56/4.0.13 OS:Windows (Windows)
Assigned to: Alexey Botchkov CPU Architecture:Any

[10 Jun 2003 17:44] Miguel Solorzano
Description:
Making a select with concat("$",format(col_num,2));

The optimized servers crash on Win9x and the debug server
shows the error message on all platforms.

Also tested the last BK 4.0

Not back trace because the compiler/debugger doesn't works
on my Win9x machine.

How to repeat:
For to see the message error:

start the server:

c:\mysql\bin>mysqld --standalone --console
030610 20:34:13  InnoDB: Started
mysqld: ready for connections.
Version: '4.0.14-max-debug-log'  socket: ''  port: 3306

open another console screen and with the mysql client:

C:\mysql\bin>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.14-max-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select concat("$",format(2500,2));
+----------------------------+
| concat("$",format(2500,2)) |
+----------------------------+
| $2,500.00                  |
+----------------------------+
1 row in set (0.17 sec)

take a look at server's screen for to see the message error:

Error: Memory allocated at c:\mysql-4.0\sql\sql_string.cpp:47 was overrun,
discovered at 'c:\mysql-4.0\sql\sql_string.h:114'

for to crash the optimized server on Win9x:

CREATE TABLE IF NOT EXISTS mc (
  bill_id    varchar(10) default null,
  bill_date  date default null,
  bill_value int default null,
  bill_type  char(1) default null
);

insert into mc ( bill_id, bill_value,bill_type )
values ("20",1500,"0"),("27",1000,"1");

select bill_id, bill_type, concat("$", format(bill_value,2)) as Price
from mc;
[3 Jul 2003 6:47] Alexey Botchkov
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html