summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2020-03-23 02:36:15 +0300
committerEugene Kosov <claprix@yandex.ru>2020-03-23 14:30:18 +0300
commitfb74de97287c1a3db718226a73c01f6334bf2877 (patch)
treec0b02cfa971264e39facb524df10b27379599ac7 /sql/sql_select.h
parent6697135c6d03935118c3dfa1c97faea7fa76afa6 (diff)
downloadmariadb-git-fb74de97287c1a3db718226a73c01f6334bf2877.tar.gz
MDEV-22006 runtime error: null pointer passed as argument 2, which is declared to never be null in JOIN::copy_ref_ptr_array()
Do not memcpy() a zero-length buffer
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r--sql/sql_select.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h
index ffc9eba1186..0e011c9267a 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -2,7 +2,7 @@
#define SQL_SELECT_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2008, 2017, MariaDB Corporation.
+ Copyright (c) 2008, 2020, MariaDB Corporation.
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
@@ -1554,6 +1554,9 @@ public:
void copy_ref_ptr_array(Ref_ptr_array dst_arr, Ref_ptr_array src_arr)
{
DBUG_ASSERT(dst_arr.size() >= src_arr.size());
+ if (src_arr.size() == 0)
+ return;
+
void *dest= dst_arr.array();
const void *src= src_arr.array();
memcpy(dest, src, src_arr.size() * src_arr.element_size());