Skip to content

Commit fb74de9

Browse files
committed
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
1 parent 6697135 commit fb74de9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sql/sql_select.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define SQL_SELECT_INCLUDED
33

44
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
5-
Copyright (c) 2008, 2017, MariaDB Corporation.
5+
Copyright (c) 2008, 2020, MariaDB Corporation.
66
77
This program is free software; you can redistribute it and/or modify
88
it under the terms of the GNU General Public License as published by
@@ -1554,6 +1554,9 @@ class JOIN :public Sql_alloc
15541554
void copy_ref_ptr_array(Ref_ptr_array dst_arr, Ref_ptr_array src_arr)
15551555
{
15561556
DBUG_ASSERT(dst_arr.size() >= src_arr.size());
1557+
if (src_arr.size() == 0)
1558+
return;
1559+
15571560
void *dest= dst_arr.array();
15581561
const void *src= src_arr.array();
15591562
memcpy(dest, src, src_arr.size() * src_arr.element_size());

0 commit comments

Comments
 (0)