From 5b83a015909e5aa7e3909a3fafa0f231360a3475 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 4 Nov 2019 13:47:21 +0100 Subject: [PATCH] PS-6052: gcc 9.2.1 reports new warnings --- storage/innobase/os/os0file.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 58b0a28b78d0..d44bfdf4b80b 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1990,6 +1990,11 @@ static char *os_file_get_parent_dir(const char *path) { return (NULL); } + /* Make sure that mem_strdupl() will get non-negative "ulint len" */ + if (last_slash - path < 0) { + return (NULL); + } + /* Non-trivial directory component */ return (mem_strdupl(path, last_slash - path));