summaryrefslogtreecommitdiff
path: root/sql/filesort.cc
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2010-01-29 13:17:57 +0400
committerRamil Kalimullin <ramil@mysql.com>2010-01-29 13:17:57 +0400
commit221cdc4084956fe86541454137eccc6ca4c21873 (patch)
tree84dfec8ca6db5f95bf5e4bc26159146943c1c829 /sql/filesort.cc
parent6e351da89bc3d4c1624ab28e23748656e8a12192 (diff)
downloadmariadb-git-221cdc4084956fe86541454137eccc6ca4c21873.tar.gz
Fix for bug#49897: crash in ptr_compare when char(0) NOT NULL
column is used for ORDER BY Problem: filesort isn't meant for null length sort data (e.g. char(0)), that leads to a server crash. Fix: disregard sort order if sort data record length is 0 (nothing to sort).
Diffstat (limited to 'sql/filesort.cc')
-rw-r--r--sql/filesort.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index f56e5b3a771..11be5d7f672 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -134,6 +134,8 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length,
error= 1;
bzero((char*) &param,sizeof(param));
param.sort_length= sortlength(thd, sortorder, s_length, &multi_byte_charset);
+ /* filesort cannot handle zero-length records. */
+ DBUG_ASSERT(param.sort_length);
param.ref_length= table->file->ref_length;
param.addon_field= 0;
param.addon_length= 0;