diff options
author | Nikša Skeledžija <niksa.skeledzija@oracle.com> | 2019-11-08 09:24:38 +0100 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-01-17 16:23:13 +0200 |
commit | c25a0662b3f169340faccbee306f84cefe2ca54e (patch) | |
tree | bfd73e3d39853ca6ba9c6090567000b1f7e0f472 | |
parent | 08b0b2b6fb849e7b440bfd104f8121b5d7d819e3 (diff) | |
download | mariadb-git-c25a0662b3f169340faccbee306f84cefe2ca54e.tar.gz |
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>
-rw-r--r-- | storage/innobase/os/os0file.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index b32a2fa77ef..065b3118413 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1,8 +1,8 @@ /*********************************************************************** -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)); |