diff options
author | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-09-30 12:43:43 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@oracle.com> | 2010-09-30 12:43:43 +0200 |
commit | bf55d1fcf0bd2dc050eabf6725f827fcf9c10cfe (patch) | |
tree | 3c8bad484e298eb47244274edb7d539f0f81b691 /sql/sql_string.cc | |
parent | 0afd0a18feb4501cafb4800115fc25f13171acf6 (diff) | |
parent | 32de99125a2fa6aace8650e8a4a1a5087fcf614a (diff) | |
download | mariadb-git-bf55d1fcf0bd2dc050eabf6725f827fcf9c10cfe.tar.gz |
Merge from mysql-5.5-bugteam to mysql-5.5-runtime
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r-- | sql/sql_string.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 762eebba031..4b7dab243d2 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -31,9 +31,12 @@ ** String functions *****************************************************************************/ -bool String::real_alloc(uint32 arg_length) +bool String::real_alloc(uint32 length) { - arg_length=ALIGN_SIZE(arg_length+1); + uint32 arg_length= ALIGN_SIZE(length + 1); + DBUG_ASSERT(arg_length > length); + if (arg_length <= length) + return TRUE; /* Overflow */ str_length=0; if (Alloced_length < arg_length) { @@ -56,6 +59,9 @@ bool String::real_alloc(uint32 arg_length) bool String::realloc(uint32 alloc_length) { uint32 len=ALIGN_SIZE(alloc_length+1); + DBUG_ASSERT(len > alloc_length); + if (len <= alloc_length) + return TRUE; /* Overflow */ if (Alloced_length < len) { char *new_ptr; |