[Lldb-commits] [lldb] 2dc6e90 - [lldb/Host] Fix crash in FileSystem::IsLocal
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 2 22:54:36 PST 2022
FileSystem has a bunch of methods that unconditionally use `m_fs`. There's
no reason `IsLocal` is special in that regard. If this crashes(which is
what the radar is about) it's because the FileSystem is not properly
initialized and we should figure out why instead.
On Fri, Feb 25, 2022 at 6:41 PM Med Ismail Bennani via lldb-commits <
lldb-commits at lists.llvm.org> wrote:
>
> Author: Med Ismail Bennani
> Date: 2022-02-25T18:33:31-08:00
> New Revision: 2dc6e906b09deb092c15a726c06d0ecbeec1eb18
>
> URL:
> https://github.com/llvm/llvm-project/commit/2dc6e906b09deb092c15a726c06d0ecbeec1eb18
> DIFF:
> https://github.com/llvm/llvm-project/commit/2dc6e906b09deb092c15a726c06d0ecbeec1eb18.diff
>
> LOG: [lldb/Host] Fix crash in FileSystem::IsLocal
>
> This checks `m_fs` before dereferencing it to access its`isLocal` method.
>
> rdar://67410058
>
> Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
>
> Added:
>
>
> Modified:
> lldb/source/Host/common/FileSystem.cpp
>
> Removed:
>
>
>
>
> ################################################################################
> diff --git a/lldb/source/Host/common/FileSystem.cpp
> b/lldb/source/Host/common/FileSystem.cpp
> index 1e4a24abe3017..26a98fa0a4ec4 100644
> --- a/lldb/source/Host/common/FileSystem.cpp
> +++ b/lldb/source/Host/common/FileSystem.cpp
> @@ -192,7 +192,8 @@ bool FileSystem::IsDirectory(const FileSpec
> &file_spec) const {
>
> bool FileSystem::IsLocal(const Twine &path) const {
> bool b = false;
> - m_fs->isLocal(path, b);
> + if (m_fs)
> + m_fs->isLocal(path, b);
> return b;
> }
>
>
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220302/917f2da0/attachment-0001.html>
More information about the lldb-commits
mailing list