Merge branch '10.5' into '10.6'

This commit is contained in:
Julius Goryavsky 2025-02-27 03:59:30 +01:00
commit e3d7d5ca26
390 changed files with 3676 additions and 1815 deletions

View file

@ -296,6 +296,7 @@ void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)),
const uchar *end = key + len;
ulong tmp1= *nr1;
ulong tmp2= *nr2;
DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */
for (; key < end ; key++)
{
@ -316,6 +317,7 @@ void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)),
'A ' and 'A' as identical
*/
const uchar *end= skip_trailing_space(key, len);
DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */
my_hash_sort_bin(cs, key, end - key, nr1, nr2);
}

View file

@ -705,7 +705,8 @@ void my_hash_sort_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
{
const uchar *end;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */
/*
Remove end space. We have to do this to be able to compare
'AE' and 'Ä' as identical

View file

@ -619,6 +619,7 @@ my_hash_sort_mb_nopad_bin(CHARSET_INFO *cs __attribute__((unused)),
{
register ulong m1= *nr1, m2= *nr2;
const uchar *end= key + len;
DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */
for (; key < end ; key++)
{
MY_HASH_ADD(m1, m2, (uint)*key);
@ -637,6 +638,7 @@ my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)),
'A ' and 'A' as identical
*/
const uchar *end= skip_trailing_space(key, len);
DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */
my_hash_sort_mb_nopad_bin(cs, key, end - key, nr1, nr2);
}

View file

@ -348,6 +348,7 @@ void my_hash_sort_simple_nopad(CHARSET_INFO *cs,
register const uchar *sort_order=cs->sort_order;
const uchar *end= key + len;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */
for (; key < (uchar*) end ; key++)
{
MY_HASH_ADD(m1, m2, (uint) sort_order[(uint) *key]);
@ -364,6 +365,7 @@ void my_hash_sort_simple(CHARSET_INFO *cs,
register const uchar *sort_order=cs->sort_order;
const uchar *end;
uint16 space_weight= sort_order[' '];
DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */
/*
Remove all trailing characters that are equal to space.

View file

@ -538,6 +538,7 @@ MY_FUNCTION_NAME(hash_sort)(CHARSET_INFO *cs,
my_uca_scanner scanner;
int space_weight= my_space_weight(&cs->uca->level[0]);
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
my_uca_scanner_init_any(&scanner, cs, &cs->uca->level[0], s, slen);
@ -591,6 +592,7 @@ MY_FUNCTION_NAME(hash_sort_nopad)(CHARSET_INFO *cs,
int s_res;
my_uca_scanner scanner;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
my_uca_scanner_init_any(&scanner, cs, &cs->uca->level[0], s, slen);

View file

@ -1361,6 +1361,7 @@ my_hash_sort_utf16_nopad(CHARSET_INFO *cs,
const uchar *e= s + slen;
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
while ((s < e) && (res= mb_wc(cs, &wc, (uchar *) s, (uchar *) e)) > 0)
{
@ -1378,6 +1379,7 @@ my_hash_sort_utf16(CHARSET_INFO *cs, const uchar *s, size_t slen,
ulong *nr1, ulong *nr2)
{
size_t lengthsp= my_ci_lengthsp(cs, (const char *) s, slen);
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
my_hash_sort_utf16_nopad(cs, s, lengthsp, nr1, nr2);
}
@ -1488,6 +1490,7 @@ my_hash_sort_utf16_nopad_bin(CHARSET_INFO *cs __attribute__((unused)),
{
const uchar *end= pos + len;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(pos); /* Avoid UBSAN nullptr-with-offset */
for ( ; pos < end ; pos++)
{
@ -1503,6 +1506,7 @@ my_hash_sort_utf16_bin(CHARSET_INFO *cs,
const uchar *pos, size_t len, ulong *nr1, ulong *nr2)
{
size_t lengthsp= my_ci_lengthsp(cs, (const char *) pos, len);
DBUG_ASSERT(pos); /* Avoid UBSAN nullptr-with-offset */
my_hash_sort_utf16_nopad_bin(cs, pos, lengthsp, nr1, nr2);
}
@ -2268,6 +2272,7 @@ my_hash_sort_utf32_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen,
const uchar *e= s + slen;
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
while ((res= my_utf32_uni(cs, &wc, (uchar*) s, (uchar*) e)) > 0)
{
@ -2288,6 +2293,7 @@ my_hash_sort_utf32(CHARSET_INFO *cs, const uchar *s, size_t slen,
ulong *nr1, ulong *nr2)
{
size_t lengthsp= my_lengthsp_utf32(cs, (const char *) s, slen);
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
my_hash_sort_utf32_nopad(cs, s, lengthsp, nr1, nr2);
}
@ -3165,6 +3171,7 @@ my_hash_sort_ucs2_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen,
const uchar *e=s+slen;
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
while ((s < e) && (res=my_ucs2_uni(cs,&wc, (uchar *)s, (uchar*)e)) >0)
{
@ -3181,6 +3188,7 @@ static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen,
ulong *nr1, ulong *nr2)
{
size_t lengthsp= my_lengthsp_mb2(cs, (const char *) s, slen);
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
my_hash_sort_ucs2_nopad(cs, s, lengthsp, nr1, nr2);
}
@ -3305,6 +3313,7 @@ my_hash_sort_ucs2_nopad_bin(CHARSET_INFO *cs __attribute__((unused)),
{
const uchar *end= key + len;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */
for ( ; key < end ; key++)
{
MY_HASH_ADD(m1, m2, (uint)*key);
@ -3319,6 +3328,7 @@ my_hash_sort_ucs2_bin(CHARSET_INFO *cs,
const uchar *key, size_t len, ulong *nr1, ulong *nr2)
{
size_t lengthsp= my_lengthsp_mb2(cs, (const char *) key, len);
DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */
my_hash_sort_ucs2_nopad_bin(cs, key, lengthsp, nr1, nr2);
}

View file

@ -4978,6 +4978,7 @@ static void my_hash_sort_utf8mb3_nopad(CHARSET_INFO *cs, const uchar *s, size_t
const uchar *e= s+slen;
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
while ((s < e) && (res=my_utf8mb3_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 )
{
@ -4998,6 +4999,7 @@ static void my_hash_sort_utf8mb3(CHARSET_INFO *cs, const uchar *s, size_t slen,
'A ' and 'A' as identical
*/
const uchar *e= skip_trailing_space(s, slen);
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
my_hash_sort_utf8mb3_nopad(cs, s, e - s, nr1, nr2);
}
@ -7429,6 +7431,7 @@ my_hash_sort_utf8mb4_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen,
const uchar *e= s + slen;
MY_UNICASE_INFO *uni_plane= cs->caseinfo;
register ulong m1= *nr1, m2= *nr2;
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
while ((res= my_mb_wc_utf8mb4(cs, &wc, (uchar*) s, (uchar*) e)) > 0)
{
@ -7461,6 +7464,7 @@ my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen,
'A ' and 'A' as identical
*/
const uchar *e= skip_trailing_space(s, slen);
DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */
my_hash_sort_utf8mb4_nopad(cs, s, e - s, nr1, nr2);
}

View file

@ -81,7 +81,7 @@
static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
{
const uchar *end= ptr + len;
DBUG_ASSERT(ptr); /* Avoid UBSAN nullptr-with-offset */
if (len > 20)
{
const uchar *end_words= (const uchar *)(intptr)