diff options
author | Rich Prohaska <prohaska@tokutek.com> | 2014-02-14 10:11:51 -0500 |
---|---|---|
committer | Rich Prohaska <prohaska@tokutek.com> | 2014-02-14 10:11:51 -0500 |
commit | 2e7e13af2d3e0b6928bf2216480c89da018957b1 (patch) | |
tree | f95a8db202ed012aa367cf0f96bfff0e786ffc59 /storage | |
parent | 567c09ad91eec3124d38b9dab919e4b90ca52f5d (diff) | |
download | mariadb-git-2e7e13af2d3e0b6928bf2216480c89da018957b1.tar.gz |
#185 fix out of range read from uint3korr
Diffstat (limited to 'storage')
-rw-r--r-- | storage/tokudb/ha_tokudb.cc | 6 | ||||
-rw-r--r-- | storage/tokudb/hatoku_cmp.cc | 10 | ||||
-rw-r--r-- | storage/tokudb/hatoku_cmp.h | 2 | ||||
-rw-r--r-- | storage/tokudb/hatoku_defines.h | 7 |
4 files changed, 16 insertions, 9 deletions
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index b7bb36ea533..c433a268d7a 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -665,8 +665,8 @@ static ulonglong retrieve_auto_increment(uint16 type, uint32 offset,const uchar break; case HA_KEYTYPE_UINT24: - unsigned_autoinc = (ulonglong) uint3korr(key); - break; + unsigned_autoinc = (ulonglong) tokudb_uint3korr(key); + break; case HA_KEYTYPE_LONGLONG: signed_autoinc = sint8korr(key); @@ -994,7 +994,7 @@ static uchar* pack_toku_field_blob( length = uint2korr(from_mysql); break; case (3): - length = uint3korr(from_mysql); + length = tokudb_uint3korr(from_mysql); break; case (4): length = uint4korr(from_mysql); diff --git a/storage/tokudb/hatoku_cmp.cc b/storage/tokudb/hatoku_cmp.cc index 70aa55e38eb..45bd44eec3c 100644 --- a/storage/tokudb/hatoku_cmp.cc +++ b/storage/tokudb/hatoku_cmp.cc @@ -428,8 +428,8 @@ static inline int cmp_toku_int (uchar* a_buf, uchar* b_buf, bool is_unsigned, ui ret_val = a_num-b_num; goto exit; case (3): - a_num = uint3korr(a_buf); - b_num = uint3korr(b_buf); + a_num = tokudb_uint3korr(a_buf); + b_num = tokudb_uint3korr(b_buf); ret_val = a_num-b_num; goto exit; case (4): @@ -663,7 +663,7 @@ static inline uchar* pack_toku_varbinary( length = uint2korr(from_mysql); break; case (3): - length = uint3korr(from_mysql); + length = tokudb_uint3korr(from_mysql); break; case (4): length = uint4korr(from_mysql); @@ -777,7 +777,7 @@ static inline uchar* pack_toku_blob( length = uint2korr(from_mysql); break; case (3): - length = uint3korr(from_mysql); + length = tokudb_uint3korr(from_mysql); break; case (4): length = uint4korr(from_mysql); @@ -932,7 +932,7 @@ static inline uchar* pack_toku_varstring( length = uint2korr(from_mysql); break; case (3): - length = uint3korr(from_mysql); + length = tokudb_uint3korr(from_mysql); break; case (4): length = uint4korr(from_mysql); diff --git a/storage/tokudb/hatoku_cmp.h b/storage/tokudb/hatoku_cmp.h index f3395279749..ca816ac52d8 100644 --- a/storage/tokudb/hatoku_cmp.h +++ b/storage/tokudb/hatoku_cmp.h @@ -243,7 +243,7 @@ static inline uint32_t get_blob_field_len( length = uint2korr(from_tokudb); break; case (3): - length = uint3korr(from_tokudb); + length = tokudb_uint3korr(from_tokudb); break; case (4): length = uint4korr(from_tokudb); diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h index 3e3e0051ba3..d12ec35119d 100644 --- a/storage/tokudb/hatoku_defines.h +++ b/storage/tokudb/hatoku_defines.h @@ -497,4 +497,11 @@ static const char *tokudb_thd_get_proc_info(THD *thd) { return thd->proc_info; } +// uint3korr reads 4 bytes and valgrind reports an error, so we use this function instead +static uint tokudb_uint3korr(const uchar *a) { + uchar b[4] = {}; + memcpy(b, a, 3); + return uint3korr(b); +} + #endif // _TOKUDB_PORTABILITY_H |