Bug #54005 Typo bug in BIT replication handling
Submitted: 26 May 2010 18:02 Modified: 7 Jul 2010 13:34
Reporter: Andrew Hutchings Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Replication Severity:S2 (Serious)
Version:mysql-5.1-telco-7.0 OS:Any
Assigned to: Martin Skold CPU Architecture:Any

[26 May 2010 18:02] Andrew Hutchings
Description:
Found whilst diagnosing bug #53622:

in ha_ndbcluster.cc:

#ifdef WORDS_BIGENDIAN
            /* lsw is stored first */
            Uint32 *buf= (Uint32 *)(*value).rec->aRef();
            field_bit->Field_bit::store((((longlong)*buf)
                                         & 0x000000000FFFFFFFFLL)
                                        |
                                        ((((longlong)*(buf+1)) << 32)
                                         & 0xFFFFFFFF00000000LL),
                                        TRUE);
#else

The first byte mask is one byte too long (has an extra 0 in it).  I am guessing worst case scenario this could cause corruption.

How to repeat:
Code review
[2 Jun 2010 9:06] 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/109893

3207 Martin Skold	2010-06-02
      Bug #54005  Typo bug in BIT replication handling: Corrected typo and added test case
      added:
        mysql-test/suite/rpl_ndb/r/rpl_ndb_bitfield.result
        mysql-test/suite/rpl_ndb/t/rpl_ndb_bitfield.test
      modified:
        sql/ha_ndbcluster_binlog.cc
[2 Jun 2010 9:51] 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/109904

3565 Martin Skold	2010-06-02 [merge]
      Merge
      added:
        mysql-test/suite/rpl_ndb/r/rpl_ndb_bitfield.result
        mysql-test/suite/rpl_ndb/t/rpl_ndb_bitfield.test
      modified:
        sql/ha_ndbcluster_binlog.cc
[2 Jun 2010 10: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/109911

3636 Martin Skold	2010-06-02 [merge]
      Merge
      added:
        mysql-test/suite/rpl_ndb/r/rpl_ndb_bitfield.result
        mysql-test/suite/rpl_ndb/t/rpl_ndb_bitfield.test
      modified:
        sql/ha_ndbcluster_binlog.cc
[7 Jul 2010 13:34] Jon Stephens
Documented bugfix in the NDB-6.3.35, 7.0.16, and 7.1.5 changelogs, as follows:

      An error in an NDB internal byte mask value could lead to 
      corruption of replicated BIT column values.

Closed.