Commit c25a0662 authored by Nikša Skeledžija's avatar Nikša Skeledžija Committed by Marko Mäkelä

Bug #30499288 - GCC 9.2.1 REPORTS A NEW WARNING FOR OS_FILE_GET_PARENT_DIR

- Fixed a warning visible in optimized build related to calling
memcpy with length parameters larger than ptrdiff_t max.

rb#23333 approved by Annamalai Gurusami <annamalai.gurusami@oracle.com>
parent 08b0b2b6
/***********************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2019, MariaDB Corporation.
Copyright (c) 2013, 2020, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
......@@ -1474,6 +1474,12 @@ os_file_get_parent_dir(
return(NULL);
}
if (last_slash - path < 0) {
/* Sanity check, it prevents gcc from trying to handle this case which
* results in warnings for some optimized builds */
return (NULL);
}
/* Non-trivial directory component */
return(mem_strdupl(path, last_slash - path));
......
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