Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1(EOL)
-
None
Description
The second StringBuffer constructor looks suspicious:
StringBuffer(const char *str, size_t length, const CHARSET_INFO *cs)
|
: String(buff, buff_sz, cs)
|
{
|
set(str, length, cs);
|
}
|
It calls this String() constructor:
String(char *str,uint32 len, CHARSET_INFO *cs)
|
{
|
Ptr=(char*) str; Alloced_length=str_length=len; extra_alloc= 0;
|
alloced= thread_specific= 0;
|
str_charset=cs;
|
}
|
and then calls this set():
inline void set(const char *str,uint32 arg_length, CHARSET_INFO *cs)
|
{
|
free();
|
Ptr=(char*) str; str_length=arg_length;
|
str_charset=cs;
|
}
|
So "ptr" does not point to StringBuffer::buff any more. This call sequence seems to have a very little sense. Perhaps it should be copy() instead of set().