summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-03-26 09:49:35 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-03-26 09:49:35 +0400
commit52d89df285ea94cbd54dba0726599acb4ff91fa4 (patch)
treebf44c28fa4ec3980528534c53a6e89a26366f729 /sql
parentbd2a0eaa82c15af2b49cfbe405489a3207f196e0 (diff)
downloadmariadb-git-52d89df285ea94cbd54dba0726599acb4ff91fa4.tar.gz
Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149
The crash happens because of incorrect max_length calculation in QUOTE function(due to overflow). max_length is set to 0 and it leads to assert failure. The fix is to cast expression result to ulonglong variable and adjust it if the result exceeds MAX_BLOB_WIDTH.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_strfunc.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 5799c768162..aedc63164f2 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -694,8 +694,9 @@ public:
String *val_str(String *);
void fix_length_and_dec()
{
+ ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 + 2;
+ max_length= min(max_result_length, MAX_BLOB_WIDTH);
collation.set(args[0]->collation);
- max_length= args[0]->max_length * 2 + 2;
}
};