Bug #8771 crashes when the ucs2 text value is NULL
Submitted: 24 Feb 2005 9:32 Modified: 2 Mar 2005 12:23
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:4.1.10 OS:Any (any)
Assigned to: Marko Mäkelä CPU Architecture:Any

[24 Feb 2005 9:32] [ name withheld ]
Description:
If the character-set of the text field is ucs2, and the value is NULL,
mysqld crashes when SELECT command was executed.

I'm using InnoDB.
This issue doesn't appear in 4.1.9.

How to repeat:
CREATE DATABASE testdb CHARACTER SET ucs2;
USE testdb;
CREATE TABLE table1 (
	id		INT		NOT NULL,
	data		MEDIUMTEXT	    NULL,
	PRIMARY KEY (id)
	);

INSERT INTO table1 VALUES (1, NULL);

/* Everything above is OK. but the next line causes crash. */

SELECT * FROM table1;
[24 Feb 2005 9:45] Hartmut Holzgraefe
Works fine on Linux, seems to be a Windows only problem?
[24 Feb 2005 9:51] MySQL Verification Team
Verified with 4.1.11-debug-log
[24 Feb 2005 19:36] Marko Mäkelä
Victoria,
Please, always post a stack trace when InnoDB is involved. I fixed some bugs in the UCS2 handling of InnoDB some time ago. Does this bug occur with ENGINE=MyISAM?
[28 Feb 2005 14:44] Marko Mäkelä
It is an InnoDB assertion failure. When a NULL BLOB record is converted from InnoDB to MySQL, the area reserved for it should not be padded with spaces (the two bytes 0x00 0x20 in UCS2) but with zero bytes. I'll adjust the "if" condition.
[2 Mar 2005 12:23] Marko Mäkelä
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

I pushed the fix to the 4.1 source tree yesterday, and I just merged it to the 5.0 tree. The fix should be included in 4.1.11 and 5.0.3.