Skip to content

Commit c25a066

Browse files
NSkeledzijadr-m
authored andcommitted
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>
1 parent 08b0b2b commit c25a066

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

storage/innobase/os/os0file.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/***********************************************************************
22
3-
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 1995, 2019, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2009, Percona Inc.
5-
Copyright (c) 2013, 2019, MariaDB Corporation.
5+
Copyright (c) 2013, 2020, MariaDB Corporation.
66
77
Portions of this file contain modifications contributed and copyrighted
88
by Percona Inc.. Those modifications are
@@ -1474,6 +1474,12 @@ os_file_get_parent_dir(
14741474
return(NULL);
14751475
}
14761476

1477+
if (last_slash - path < 0) {
1478+
/* Sanity check, it prevents gcc from trying to handle this case which
1479+
* results in warnings for some optimized builds */
1480+
return (NULL);
1481+
}
1482+
14771483
/* Non-trivial directory component */
14781484

14791485
return(mem_strdupl(path, last_slash - path));

0 commit comments

Comments
 (0)