mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Code layout fix for bug N 27079
Thanks to Gluh for suggestion.
This commit is contained in:
parent
6370f6226f
commit
ee0475bf5d
1 changed files with 16 additions and 17 deletions
|
|
@ -6777,25 +6777,24 @@ static void my_uca_scanner_init_ucs2(my_uca_scanner *scanner,
|
||||||
scanner->uca_length= cs->sort_order;
|
scanner->uca_length= cs->sort_order;
|
||||||
scanner->uca_weight= cs->sort_order_big;
|
scanner->uca_weight= cs->sort_order_big;
|
||||||
scanner->contractions= cs->contractions;
|
scanner->contractions= cs->contractions;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
/*
|
||||||
/*
|
Sometimes this function is called with
|
||||||
Sometimes this function is called with
|
str=NULL and length=0, which should be
|
||||||
str=NULL and length=0, which should be
|
considered as an empty string.
|
||||||
considered as an empty string.
|
|
||||||
|
The above initialization is unsafe for such cases,
|
||||||
|
because scanner->send is initialized to (NULL-2), which is 0xFFFFFFFE.
|
||||||
|
Then we fall into an endless loop in my_uca_scanner_next_ucs2().
|
||||||
|
|
||||||
The above initialization is unsafe for such cases,
|
Do special initialization for the case when length=0.
|
||||||
because scanner->send is initialized to (NULL-2), which is 0xFFFFFFFE.
|
Initialize scanner->sbeg to an address greater than scanner->send.
|
||||||
Then we fall into an endless loop in my_uca_scanner_next_ucs2().
|
Next call of my_uca_scanner_next_ucs2() will correctly return with -1.
|
||||||
|
*/
|
||||||
Do special initialization for the case when length=0.
|
scanner->sbeg= (uchar*) &nochar[1];
|
||||||
Initialize scanner->sbeg to an address greater than scanner->send.
|
scanner->send= (uchar*) &nochar[0];
|
||||||
Next call of my_uca_scanner_next_ucs2() will correctly return with -1.
|
|
||||||
*/
|
|
||||||
scanner->sbeg= (uchar*) &nochar[1];
|
|
||||||
scanner->send= (uchar*) &nochar[0];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue