diff options
| author | asorotsky <[email protected]> | 2022-08-12 01:12:02 +0300 |
|---|---|---|
| committer | asorotsky <[email protected]> | 2022-08-12 01:12:02 +0300 |
| commit | 4d7344c0d41037b9e5644ea94d61b5fc96b36abf (patch) | |
| tree | 1f67a00cc1315c912156c1ef790c81122249bf73 | |
| parent | e51b4e60d28fc2ca75759e7d684f8ad772646634 (diff) | |
fix UB in case of empty stringbuf
| -rw-r--r-- | util/folder/path.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/util/folder/path.cpp b/util/folder/path.cpp index 7f920db8f00..cecef719717 100644 --- a/util/folder/path.cpp +++ b/util/folder/path.cpp @@ -18,7 +18,11 @@ struct TFsPath::TSplit: public TAtomicRefCount<TSplit>, public TPathSplit { for (const auto& part : that) { emplace_back(path.begin() + (part.data() - other.begin()), part.size()); } - Drive = TStringBuf(path.begin() + (that.Drive.data() - other.begin()), that.Drive.size()); + + if (!that.Drive.empty()) { + Drive = TStringBuf(path.begin() + (that.Drive.data() - other.begin()), that.Drive.size()); + } + IsAbsolute = that.IsAbsolute; } }; |
