summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorserg@serg.mylan <>2003-11-28 12:36:45 +0100
committerserg@serg.mylan <>2003-11-28 12:36:45 +0100
commit16e5b4f0ba9db861585a0667fdee1dae1cc1e267 (patch)
tree019fc0ea59e4c997f7ad60ca7b8f05998064236b
parent531eb44301e559cc10a6c5905b6a87787ae17be6 (diff)
downloadmariadb-git-16e5b4f0ba9db861585a0667fdee1dae1cc1e267.tar.gz
bug #1945. item(expression)->name=0, crash in find_item_in_list
-rw-r--r--mysql-test/r/order_by.result4
-rw-r--r--mysql-test/t/order_by.test8
-rw-r--r--sql/sql_base.cc2
3 files changed, 13 insertions, 1 deletions
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 076c80035b2..093633d5f5a 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -542,3 +542,7 @@ a b
1 2
5 NULL
DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT);
+SET @id=0;
+UPDATE t1 SET a=0 ORDER BY (a=@id), b;
+DROP TABLE t1;
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 1fb83509ebb..8215ec84ae3 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -345,3 +345,11 @@ SELECT * FROM t1 ORDER BY (a + b);
SELECT * FROM t1 ORDER BY (a + b) DESC;
DROP TABLE t1;
+#
+# Bug #1945 - Crashing bug with bad User Variables in UPDATE ... ORDER BY ...
+#
+CREATE TABLE t1 (a INT, b INT);
+SET @id=0;
+UPDATE t1 SET a=0 ORDER BY (a=@id), b;
+DROP TABLE t1;
+
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 47529b90b67..e4694adb9a2 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1837,7 +1837,7 @@ find_item_in_list(Item *find,List<Item> &items)
}
}
else if (!table_name && (item->eq(find,0) ||
- find->name &&
+ find->name && item->name &&
!my_strcasecmp(item->name,find->name)))
{
found=li.ref();