Commit ee0475bf authored by unknown's avatar unknown

Code layout fix for bug N 27079

Thanks to Gluh for suggestion.

parent 6370f622
...@@ -6777,25 +6777,24 @@ static void my_uca_scanner_init_ucs2(my_uca_scanner *scanner, ...@@ -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,
The above initialization is unsafe for such cases, because scanner->send is initialized to (NULL-2), which is 0xFFFFFFFE.
because scanner->send is initialized to (NULL-2), which is 0xFFFFFFFE. Then we fall into an endless loop in my_uca_scanner_next_ucs2().
Then we fall into an endless loop in my_uca_scanner_next_ucs2().
Do special initialization for the case when length=0. Do special initialization for the case when length=0.
Initialize scanner->sbeg to an address greater than scanner->send. Initialize scanner->sbeg to an address greater than scanner->send.
Next call of my_uca_scanner_next_ucs2() will correctly return with -1. Next call of my_uca_scanner_next_ucs2() will correctly return with -1.
*/ */
scanner->sbeg= (uchar*) &nochar[1]; scanner->sbeg= (uchar*) &nochar[1];
scanner->send= (uchar*) &nochar[0]; scanner->send= (uchar*) &nochar[0];
}
} }
......
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