mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Fix of incorrect casting for large sizes
This commit is contained in:
parent
272b9ad5de
commit
cc87cb9fbf
1 changed files with 7 additions and 8 deletions
|
@ -311,18 +311,17 @@ typedef struct st_mysql_lex_string LEX_STRING;
|
||||||
|
|
||||||
static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
|
static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
|
||||||
{
|
{
|
||||||
const uchar *start= ptr;
|
|
||||||
const uchar *end= ptr + len;
|
const uchar *end= ptr + len;
|
||||||
|
|
||||||
if (len > 20)
|
if (len > 20)
|
||||||
{
|
{
|
||||||
const uchar *end_words= (const uchar *)
|
const uchar *end_words= (const uchar *)(intptr)
|
||||||
(((intptr)end) / SIZEOF_INT * SIZEOF_INT);
|
(((ulonglong)(intptr)end) / SIZEOF_INT * SIZEOF_INT);
|
||||||
const uchar *start_words= (const uchar *)
|
const uchar *start_words= (const uchar *)(intptr)
|
||||||
((((intptr)start) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT);
|
((((ulonglong)(intptr)ptr) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT);
|
||||||
|
|
||||||
DBUG_ASSERT(((intptr)start) >= SIZEOF_INT);
|
DBUG_ASSERT(((ulonglong)(intptr)ptr) >= SIZEOF_INT);
|
||||||
if (end_words > start)
|
if (end_words > ptr)
|
||||||
{
|
{
|
||||||
while (end > end_words && end[-1] == 0x20)
|
while (end > end_words && end[-1] == 0x20)
|
||||||
end--;
|
end--;
|
||||||
|
@ -331,7 +330,7 @@ static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
|
||||||
end -= SIZEOF_INT;
|
end -= SIZEOF_INT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (end > start && end[-1] == 0x20)
|
while (end > ptr && end[-1] == 0x20)
|
||||||
end--;
|
end--;
|
||||||
return (end);
|
return (end);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue