summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2020-01-15 16:34:51 +0300
committerSergei Petrunia <psergey@askmonty.org>2020-01-15 16:34:51 +0300
commit4635047ca1dbcd8b536da4be9236ffab8d48f2d9 (patch)
tree1947bab02b2c0ed0d7a832d6d922929a8352ee6d
parent5e5ae51b730aa67f9efb87af4f4921309eac51f1 (diff)
downloadmariadb-git-4635047ca1dbcd8b536da4be9236ffab8d48f2d9.tar.gz
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.
-rw-r--r--sql/item_func.cc3
1 files changed, 2 insertions, 1 deletions
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);
}