summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jonas@perch.ndb.mysql.com>2006-01-02 14:38:38 +0100
committerunknown <jonas@perch.ndb.mysql.com>2006-01-02 14:38:38 +0100
commit07908a45448f5eeaa536f7798a0ed4b548c5e1c7 (patch)
treee529b73f91ef3565d758232daad77a8aaebcb064
parent979c824e127741bab241de0a9dd997bb9aabb1da (diff)
downloadmariadb-git-07908a45448f5eeaa536f7798a0ed4b548c5e1c7.tar.gz
bug#16125 - ndb bitfield of exact 32 bits, incorrect assertion (i.e. only noticable in debug compiled)
mysql-test/r/ndb_bitfield.result: bug#16125 mysql-test/t/ndb_bitfield.test: bug#16125 ndb/include/util/Bitmask.hpp: bug#16125
-rw-r--r--mysql-test/r/ndb_bitfield.result6
-rw-r--r--mysql-test/t/ndb_bitfield.test8
-rw-r--r--ndb/include/util/Bitmask.hpp4
3 files changed, 16 insertions, 2 deletions
diff --git a/mysql-test/r/ndb_bitfield.result b/mysql-test/r/ndb_bitfield.result
index bf5a9b1ade1..9a941862854 100644
--- a/mysql-test/r/ndb_bitfield.result
+++ b/mysql-test/r/ndb_bitfield.result
@@ -208,3 +208,9 @@ b bit(9),
key(b)
) engine=ndbcluster;
ERROR HY000: Can't create table './test/t1.frm' (errno: 743)
+create table t1 (
+pk1 int primary key,
+b bit(32) not null
+) engine=ndbcluster;
+insert into t1 values (1,1);
+drop table t1;
diff --git a/mysql-test/t/ndb_bitfield.test b/mysql-test/t/ndb_bitfield.test
index 0256ecf89ed..59d6e56577e 100644
--- a/mysql-test/t/ndb_bitfield.test
+++ b/mysql-test/t/ndb_bitfield.test
@@ -112,3 +112,11 @@ create table t1 (
key(b)
) engine=ndbcluster;
+# bug#16125
+create table t1 (
+ pk1 int primary key,
+ b bit(32) not null
+) engine=ndbcluster;
+
+insert into t1 values (1,1);
+drop table t1;
diff --git a/ndb/include/util/Bitmask.hpp b/ndb/include/util/Bitmask.hpp
index ade57a5ee57..7957bf7a48d 100644
--- a/ndb/include/util/Bitmask.hpp
+++ b/ndb/include/util/Bitmask.hpp
@@ -814,7 +814,7 @@ inline void
BitmaskImpl::getField(unsigned size, const Uint32 src[],
unsigned pos, unsigned len, Uint32 dst[])
{
- assert(pos + len < (size << 5));
+ assert(pos + len <= (size << 5));
src += (pos >> 5);
Uint32 offset = pos & 31;
@@ -833,7 +833,7 @@ inline void
BitmaskImpl::setField(unsigned size, Uint32 dst[],
unsigned pos, unsigned len, const Uint32 src[])
{
- assert(pos + len < (size << 5));
+ assert(pos + len <= (size << 5));
dst += (pos >> 5);
Uint32 offset = pos & 31;