diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2015-06-17 13:44:32 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2015-06-17 13:44:32 +0200 |
commit | 0dedf55d5d12d70f8c81f61ca562b312ae66a9f1 (patch) | |
tree | 865de9451bc8ea46f1940cfe7ad05261c3d1418c /mysys/ptr_cmp.c | |
parent | bb7951ae9558d1af6ddbae443f215ba7b788414f (diff) | |
download | mariadb-git-0dedf55d5d12d70f8c81f61ca562b312ae66a9f1.tar.gz |
Bug#19660891 HANDLE_FATAL_SIGNAL (SIG=11) IN QUEUE_INSERT
Backport from 5.6 to 5.5
This makes filesort robust to misc variants of order by / group by
on columns/expressions with zero length.
Diffstat (limited to 'mysys/ptr_cmp.c')
-rw-r--r-- | mysys/ptr_cmp.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/mysys/ptr_cmp.c b/mysys/ptr_cmp.c index 6f9ab13c82b..cbd8ef49ef5 100644 --- a/mysys/ptr_cmp.c +++ b/mysys/ptr_cmp.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,6 +41,16 @@ static int native_compare(size_t *length, unsigned char **a, unsigned char **b) #else /* __sun */ +/** + Special case for ORDER BY / GROUP BY CHAR(0) NOT NULL + */ +static +int ptr_compare_zero_length(size_t *compare_length __attribute__((unused)), + uchar **a __attribute__((unused)), + uchar **b __attribute__((unused))) +{ + return 0; +} static int ptr_compare(size_t *compare_length, uchar **a, uchar **b); static int ptr_compare_0(size_t *compare_length, uchar **a, uchar **b); static int ptr_compare_1(size_t *compare_length, uchar **a, uchar **b); @@ -58,6 +68,8 @@ qsort2_cmp get_ptr_compare (size_t size __attribute__((unused))) #else qsort2_cmp get_ptr_compare (size_t size) { + if (size == 0) + return (qsort2_cmp) ptr_compare_zero_length; if (size < 4) return (qsort2_cmp) ptr_compare; switch (size & 3) { @@ -85,6 +97,7 @@ static int ptr_compare(size_t *compare_length, uchar **a, uchar **b) reg3 int length= *compare_length; reg1 uchar *first,*last; + DBUG_ASSERT(length > 0); first= *a; last= *b; while (--length) { |