summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2005-02-12 20:09:40 +0400
committerunknown <hf@deer.(none)>2005-02-12 20:09:40 +0400
commit4810f300d29a81db4c96d6cfc0185927eddb2568 (patch)
treea5ac09a8d86e4103c836f58533c51509673fa7f6 /libmysqld
parent8ed40c4b09bb4c56f17a1432fc9024a5dfc4e04a (diff)
downloadmariadb-git-4810f300d29a81db4c96d6cfc0185927eddb2568.tar.gz
Fix for bug #8477 (Embedded query_cache test crashes)
libmysqld/emb_qcache.cc: Querycahce data transition fixed
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/emb_qcache.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc
index 7d83023abd5..2d3d82b7952 100644
--- a/libmysqld/emb_qcache.cc
+++ b/libmysqld/emb_qcache.cc
@@ -71,9 +71,11 @@ void Querycache_stream::store_int(uint i)
cur_data+= 4;
return;
}
- memcpy(cur_data, &i, rest_len);
+ char buf[4];
+ int4store(buf, i);
+ memcpy(cur_data, buf, rest_len);
use_next_block();
- memcpy(cur_data, ((byte*)&i)+rest_len, 4-rest_len);
+ memcpy(cur_data, buf+rest_len, 4-rest_len);
cur_data+= 4-rest_len;
}
@@ -186,10 +188,12 @@ uint Querycache_stream::load_int()
cur_data+= 4;
return result;
}
- memcpy(&result, cur_data, rest_len);
+ char buf[4];
+ memcpy(buf, cur_data, rest_len);
use_next_block();
- memcpy(((byte*)&result)+rest_len, cur_data, 4-rest_len);
+ memcpy(buf+rest_len, cur_data, 4-rest_len);
cur_data+= 4-rest_len;
+ result= uint4korr(buf);
return result;
}
@@ -270,10 +274,10 @@ int Querycache_stream::load_column(MEM_ROOT *alloc, char** column)
return 0;
}
len--;
- if (!(*column= (char *)alloc_root(alloc, len + 4 + 1)))
+ if (!(*column= (char *)alloc_root(alloc, len + sizeof(uint) + 1)))
return 1;
- int4store(*column, len);
- (*column)+= 4;
+ *((uint*)*column)= len;
+ (*column)+= sizeof(uint);
load_str_only(*column, len);
return 1;
}