Commit 2e7e13af authored by Rich Prohaska's avatar Rich Prohaska

#185 fix out of range read from uint3korr

parent 567c09ad
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment