Commit fb74de97 authored by Eugene Kosov's avatar Eugene Kosov

MDEV-22006 runtime error: null pointer passed as argument 2, which is declared...

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
parent 6697135c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define SQL_SELECT_INCLUDED #define SQL_SELECT_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. /* 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 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 it under the terms of the GNU General Public License as published by
...@@ -1554,6 +1554,9 @@ class JOIN :public Sql_alloc ...@@ -1554,6 +1554,9 @@ class JOIN :public Sql_alloc
void copy_ref_ptr_array(Ref_ptr_array dst_arr, Ref_ptr_array src_arr) void copy_ref_ptr_array(Ref_ptr_array dst_arr, Ref_ptr_array src_arr)
{ {
DBUG_ASSERT(dst_arr.size() >= src_arr.size()); DBUG_ASSERT(dst_arr.size() >= src_arr.size());
if (src_arr.size() == 0)
return;
void *dest= dst_arr.array(); void *dest= dst_arr.array();
const void *src= src_arr.array(); const void *src= src_arr.array();
memcpy(dest, src, src_arr.size() * src_arr.element_size()); memcpy(dest, src, src_arr.size() * src_arr.element_size());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment