summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorMartin Hansson <mhansson@mysql.com>2009-04-29 14:00:34 +0200
committerMartin Hansson <mhansson@mysql.com>2009-04-29 14:00:34 +0200
commit45cbd32697abbc29d793746f58faecef90c15aaa (patch)
tree406e101e58d4e13926739ab9b3f9a23d08daccb6 /storage/myisam
parente7c4b2dfc77ae7cc8012f43b05991bdda044a459 (diff)
downloadmariadb-git-45cbd32697abbc29d793746f58faecef90c15aaa.tar.gz
Bug#43737: Select query return bad result
A bug in the initialization of key segment information made it point to the wrong bit, since a bit index was used when its int value was needed. This lead to misinterpretation of bit columns read from MyISAM record format when a NULL bit pushed them over a byte boundary. Fixed by using the int value of the bit instead. mysql-test/r/myisam.result: Bug#43737: Test result. mysql-test/t/myisam.test: Bug#43737: Test case. storage/myisam/mi_open.c: Bug#43737: fix.
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/mi_open.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 78749d50fe5..328cde20923 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -1160,7 +1160,8 @@ uchar *mi_keyseg_read(uchar *ptr, HA_KEYSEG *keyseg)
keyseg->null_pos = mi_uint4korr(ptr); ptr +=4;
keyseg->charset=0; /* Will be filled in later */
if (keyseg->null_bit)
- keyseg->bit_pos= (uint16)(keyseg->null_pos + (keyseg->null_bit == 7));
+ /* We adjust bit_pos if null_bit is last in the byte */
+ keyseg->bit_pos= (uint16)(keyseg->null_pos + (keyseg->null_bit == (1 << 7)));
else
{
keyseg->bit_pos= (uint16)keyseg->null_pos;