From 4635047ca1dbcd8b536da4be9236ffab8d48f2d9 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 15 Jan 2020 16:34:51 +0300 Subject: MDEV-21341: Fix UBSAN failures, part #5 Item_cond inherits from Item_args but doesn't store its arguments as function arguments, which means it has zero arguments. Don't call memcpy in this case. --- sql/item_func.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index 702d8a1a2ee..ffd2b462431 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -109,7 +109,8 @@ Item_args::Item_args(THD *thd, const Item_args *other) arg_count= 0; return; } - memcpy(args, other->args, sizeof(Item*) * arg_count); + if (arg_count) + memcpy(args, other->args, sizeof(Item*) * arg_count); } -- cgit v1.2.1