Bug #46387 VB.NET crash, Buffer overrun detected, because timestamp(12) is '000000000000'
Submitted: 26 Jul 2009 9:46 Modified: 24 Feb 2010 14:29
Reporter: David Yang Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.27 OS:Windows
Assigned to: CPU Architecture:Any
Tags: ODBC

[26 Jul 2009 9:46] David Yang
Description:
Test State:

Windows XP SP3 
【VB.NET 2003  connecting MySQL using MyODBC 3.51.27 】

Bug Data:
MySQL 4.0.24 (timestamp(12) value is 000000000000) (12 words)

==========================

Using old MyODBC Version 3.51.10, 
reading "000000000000", the return value is null
(only get null, the program will not crash)

==========================

if changed timestamp(12) to timestamp(14)
Default Value Auto Changed to "00000000000000" (14 words)
Using MyODBC 3.51.27 reading "00000000000000", 
the return value is null
the program will not crash

How to repeat:
install MySQL 4.0.24  (very old's version)

CREATE TABLE `xxtable` (
  `createtime` timestamp(12) NOT NULL,
  `timestamp` timestamp(14) NOT NULL default '00000000000000'
) TYPE=MyISAM;

insert into xxtable (createtime) values ('000000000000');

using VB.NET to read data 【 select * from xxtable limit 1; 】

the program will be crash 【Buffer overrun detected!!!】

Suggested fix:
AutoChange timestamp value to "14 words"(append zero to 14 words)
 or "return null"

ex: timestamp(10)  "xxxxxxxxxx"
Return value "xxxxxxxxxx0000"  (append 4 words)
[27 Jul 2009 6:45] Tonci Grgin
Hi David and thanks for your report.

Unfortunately for you, there have been many incompatible changes since
MySQL server 4.0.x (which is EOL-ed btw) so you will have to upgrade
server first:
http://dev.mysql.com/doc/refman/6.0/en/connector-odbc-versions.html
"... is designed to work with all versions of MySQL from 4.1."

Mind you, zero-date is *not* allowed by ODBC specs, please read more on MSDN.

So please upgrade your old MySQL server and retest.
[27 Aug 2009 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".