Skip to content

Commit

Permalink
MDEV-22006 runtime error: null pointer passed as argument 2, which is…
Browse files Browse the repository at this point in the history
… declared to never be null in JOIN::copy_ref_ptr_array()

Do not memcpy() a zero-length buffer
  • Loading branch information
kevgs committed Mar 23, 2020
1 parent 6697135 commit fb74de9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sql/sql_select.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1554,6 +1554,9 @@ class JOIN :public Sql_alloc
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());
Expand Down

0 comments on commit fb74de9

Please sign in to comment.