Bug #45168 assertion with convert() and empty set value
Submitted: 28 May 2009 19:47 Modified: 17 Jul 2009 3:36
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DML Severity:S1 (Critical)
Version:5.1.36-debug OS:Linux (32-bit fc8)
Assigned to: Martin Hansson CPU Architecture:Any
Tags: convert, regression

[28 May 2009 19:47] Shane Bester
Description:
from today's 5.1 bzr:

Version: '5.1.36-debug'  socket: '/tmp/mysql.sock'  port: 3306  yes
[New Thread -1271387248 (LWP 15336)]
mysqld: sql_string.cc:332: bool String::copy(const char*, uint32, CHARSET_INFO*, CHARSET_INFO*, uint*): Assertion `str != Ptr' failed.

#0 in __kernel_vsyscall ()
#1 in raise 
#2 in abort 
#3 in __assert_fail 
#4 in String::copy  at sql_string.cc:332
#5 in Item_func_conv_charset::val_str  at item_strfunc.cc:2724
#6 in Item::send at item.cc:5508
#7 in select_send::send_data  at sql_class.cc:1587
#8 in end_send  at sql_select.cc:11986
#9 in do_select  at sql_select.cc:10864
#10 in JOIN::exec  at sql_select.cc:2199
#11 in mysql_select  at sql_select.cc:2386
#12 in handle_select 
#13 in execute_sqlcom_select 
#14 in mysql_execute_command 
#15 in mysql_parse 
#16 in dispatch_command 
#17 in do_command 
#18 in handle_one_connection 

How to repeat:
drop table if exists `t1`;
create table `t1`(`a` set('a'));
insert into `t1` values ('');
select convert(`a` using latin1) from `t1` ;
[28 May 2009 21:35] Sveta Smirnova
Thank you for the report.

Verified as described.
[11 Jun 2009 11:07] 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/76106

2931 Martin Hansson	2009-06-11
      Bug#45168: assertion with convert() and empty set value
      
      The assertion in String::copy was added in order to avoid
      valgrind errors when the destination was the same as the source.
      Eased restriction to allow for the case when length is 0.
     @ mysql-test/r/func_set.result
        Bug#45168: Test Result
     @ mysql-test/t/func_set.test
        Bug#45168: Test case.
     @ sql/sql_string.cc
        Bug#45168: Fix and clarified comment.
[16 Jun 2009 14:40] 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/76399

2931 Martin Hansson	2009-06-16
      Bug#45168: assertion with convert() and empty set value
            
      The assertion in String::copy was added in order to avoid
      valgrind errors when the destination was the same as the source.
      Eased restriction to allow for the case when str == NULL.
     @ mysql-test/r/func_set.result
        Bug#45168: Test result
     @ mysql-test/t/func_set.test
        Bug#45168: Test case
     @ sql/item_strfunc.cc
        Bug#45168: Code cleanup and grammar correction in comment
     @ sql/sql_string.cc
        Bug#45168: Fix
[17 Jun 2009 12:21] Martin Hansson
Both reviewers are done.
[8 Jul 2009 13:30] Bugs System
Pushed into 5.1.37 (revid:joro@sun.com-20090708131116-kyz8iotbum8w9yic) (version source revid:mhansson@mysql.com-20090618072546-8ksflicrhzi8yuyw) (merge vers: 5.1.36) (pib:11)
[9 Jul 2009 7:36] Bugs System
Pushed into 5.1.37 (revid:joro@sun.com-20090708131116-kyz8iotbum8w9yic) (version source revid:mhansson@mysql.com-20090618072546-8ksflicrhzi8yuyw) (merge vers: 5.1.36) (pib:11)
[10 Jul 2009 11:20] Bugs System
Pushed into 5.4.4-alpha (revid:anozdrin@bk-internal.mysql.com-20090710111017-bnh2cau84ug1hvei) (version source revid:mhansson@mysql.com-20090618064925-hf8g6oscvrdjk3qs) (merge vers: 5.4.4-alpha) (pib:11)
[17 Jul 2009 3:36] Paul DuBois
Noted in 5.1.37, 5.4.4 changelogs.

Use of CONVERT() with an empty SET value could cause an assertion
failure.
[12 Aug 2009 22:18] Paul DuBois
Noted in 5.4.2 changelog because next 5.4 version will be 5.4.2 and not 5.4.4.
[14 Aug 2009 23:09] Paul DuBois
Ignore previous comment about 5.4.2.
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 2009 13:48] Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 2009 16:32] Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[7 Oct 2009 18:40] Paul DuBois
The 5.4 fix has been pushed to 5.4.2.