| Bug #29087 | select hex(col) from .. where col = unhex(...); crashes server | ||
|---|---|---|---|
| Submitted: | 13 Jun 2007 20:13 | Modified: | 2 Aug 2007 9:34 | 
| Reporter: | Miguel Solorzano | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S1 (Critical) | 
| Version: | 5.0BK/5.1BK | OS: | Linux (FC 6 32-bit) | 
| Assigned to: | Igor Babaev | CPU Architecture: | Any | 
   [13 Jun 2007 20:13]
   Miguel Solorzano        
  
 
   [13 Jun 2007 20:19]
   MySQL Verification Team        
  5.1 crashes too:
[miguel@light 5.1]$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.20-beta-debug Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create table tt(bin_col binary(20) NOT NULL DEFAULT
    -> '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', unique key(bin_col));
Query OK, 0 rows affected (0.14 sec)
mysql> insert into tt set bin_col = unhex('1F9480179366F2BF567E1C4B964C1EF029087575');
Query OK, 1 row affected (0.00 sec)
mysql> insert into tt set bin_col = unhex('1F9480179366F2BF567E1C4B964C1EF029087520');
Query OK, 1 row affected (0.00 sec)
mysql> select hex(bin_col) from tt where bin_col =
    -> unhex('1F9480179366F2BF567E1C4B964C1EF029087520');
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
 
   [22 Jun 2007 6:29]
   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/29364 ChangeSet@1.2502, 2007-06-21 23:30:59-07:00, igor@olga.mysql.com +2 -0 Fixed bug #29087. This bug manifested itself for queries that performed a lookup into a BINARY index by a key ended with spaces. It caused an assertion abort for a debug version and wrong results for non-debug versions. The problem occurred because the function _me_prefix_key assumed that the trailing spaces had been stripped off from index entries while the function _mi_make_key erroneously did not do it and as a result all BINARY keys were inserted into indexes with trailing spaces.
   [22 Jun 2007 18:28]
   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/29432 ChangeSet@1.2502, 2007-06-22 11:31:06-07:00, igor@olga.mysql.com +3 -0 Fixed bug #29087. This bug manifested itself for queries that performed a lookup into a BINARY index by a key ended with spaces. It caused an assertion abort for a debug version and wrong results for non-debug versions. The problem occurred because the function _me_prefix_key assumed that the trailing spaces had been stripped off from index entries while the function _mi_make_key erroneously did not do it and as a result all BINARY keys were inserted into indexes with trailing spaces.
   [26 Jun 2007 5:45]
   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/29571 ChangeSet@1.2502, 2007-06-25 22:44:22-07:00, igor@olga.mysql.com +3 -0 Fixed bug #29087. This bug manifested itself for queries that performed a lookup into a BINARY index by a key ended with spaces. It caused an assertion abort for a debug version and wrong results for non-debug versions. The problem occurred because the function _mi_pack_key stripped off the trailing spaces from binary search keys while the function _mi_make_key did not do it when keys were inserted into the index. Now the function _mi_pack_key does not remove the trailing spaces from search keys if they are of the binary type.
   [1 Jul 2007 19:58]
   Bugs System        
  Pushed into 5.1.21-beta
   [1 Jul 2007 20:02]
   Bugs System        
  Pushed into 5.0.46
   [4 Jul 2007 1:47]
   Paul DuBois        
  Noted in 5.0.46, 5.1.21 changelogs. Queries that performed a lookup into a BINARY index containing key values ending with spaces caused an assertion failure for debug builds and incorrect results for non-debug builds.
   [2 Aug 2007 7:53]
   Sveta Smirnova        
  Bug still exists in 5.0.45, community and Falcon trees.
   [2 Aug 2007 7:54]
   Sveta Smirnova        
  Bug #30196 was marked as duplicate of this one.
   [2 Aug 2007 9:34]
   Sveta Smirnova        
  Due to internal discussion Bug #30196 has been reclassified as "Packaging" and this one closed again.
   [18 Aug 2008 19:00]
   Sveta Smirnova        
  Bug #38819 was marked as duplicate of this one.
