Skip to content

Commit 269dac6

Browse files
author
Tor Didriksen
committed
Bug#35195181 mysqld crash in make_sortkey_from_item
Propagate errors properly when evaluating Items to be sorted by filesort. Change-Id: Iee76ccedfe764a8d94c593feebd3c8094125b8eb (cherry picked from commit 57169f5077535283c842bb4caed04024ee8cd05c)
1 parent 26677c2 commit 269dac6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sql/filesort.cc

+9
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,9 @@ size_t make_sortkey_from_item(Item *item, Item_result result_type,
12621262
const CHARSET_INFO *cs = item->collation.collation;
12631263

12641264
String *res = item->val_str(tmp_buffer);
1265+
if (current_thd->is_error()) {
1266+
return UINT_MAX;
1267+
}
12651268
if (res == nullptr) // Value is NULL.
12661269
{
12671270
assert(item->is_nullable());
@@ -1307,6 +1310,9 @@ size_t make_sortkey_from_item(Item *item, Item_result result_type,
13071310
case INT_RESULT: {
13081311
assert(!is_varlen);
13091312
longlong value = item->int_sort_key();
1313+
if (current_thd->is_error()) {
1314+
return UINT_MAX;
1315+
}
13101316

13111317
/*
13121318
Note: item->null_value can't be trusted alone here; there are cases
@@ -1356,6 +1362,9 @@ size_t make_sortkey_from_item(Item *item, Item_result result_type,
13561362
case REAL_RESULT: {
13571363
assert(!is_varlen);
13581364
double value = item->val_real();
1365+
if (current_thd->is_error()) {
1366+
return UINT_MAX;
1367+
}
13591368
if (item->null_value) {
13601369
assert(item->is_nullable());
13611370
*null_indicator = 0;

0 commit comments

Comments
 (0)