mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
The patch for MDEV-8466 revealed a bug in str2my_decimal,
which did not return a correct "end_of_num" pointer in case of character sets with mbminlen>1 (ucs2, utf16, utf16le, utf32). The bug caused sporadic test failures on BuildBot, as well "uninitialized memory read" errors in valgrind builds.
This commit is contained in:
parent
c83810f402
commit
f789158ddf
1 changed files with 10 additions and 10 deletions
|
@ -243,21 +243,21 @@ int str2my_decimal(uint mask, const char *from, uint length,
|
|||
const char **end_ptr)
|
||||
{
|
||||
int err;
|
||||
char buff[STRING_BUFFER_USUAL_SIZE];
|
||||
String tmp(buff, sizeof(buff), &my_charset_bin);
|
||||
if (charset->mbminlen > 1)
|
||||
{
|
||||
StringBuffer<STRING_BUFFER_USUAL_SIZE> tmp;
|
||||
uint dummy_errors;
|
||||
tmp.copy(from, length, charset, &my_charset_latin1, &dummy_errors);
|
||||
from= tmp.ptr();
|
||||
length= tmp.length();
|
||||
charset= &my_charset_bin;
|
||||
char *end= (char*) tmp.end();
|
||||
err= string2decimal(tmp.ptr(), (decimal_t*) decimal_value, &end);
|
||||
*end_ptr= from + charset->mbminlen * (size_t) (end - tmp.ptr());
|
||||
}
|
||||
else
|
||||
{
|
||||
char *end= (char*) from + length;
|
||||
err= string2decimal(from, (decimal_t*) decimal_value, &end);
|
||||
*end_ptr= end;
|
||||
}
|
||||
char *end= (char*) from + length;
|
||||
err= string2decimal((char *)from, (decimal_t*) decimal_value, &end);
|
||||
if (charset->mbminlen > 1)
|
||||
end= (char *) from + charset->mbminlen * (size_t) (end - buff);
|
||||
*end_ptr= end;
|
||||
check_result_and_overflow(mask, err, decimal_value);
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue