diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-11-28 16:14:41 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-12-13 15:19:41 +0000 |
commit | 61d9742824d54be5693191fe502325a909feca59 (patch) | |
tree | cbf28e779b11338fe52eb75b915684cd8955542c /chromium/base/files/file_util.h | |
parent | 45f9ded08bb7526984b24ccb5a5327aaf6821676 (diff) |
BASELINE: Update Chromium to 108.0.5359.70
Change-Id: I77334ff232b819600f275bd3cfe41fbaa3619230
Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/445904
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/base/files/file_util.h')
-rw-r--r-- | chromium/base/files/file_util.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/chromium/base/files/file_util.h b/chromium/base/files/file_util.h index d4a3d0d7c41..e2bd557a4e6 100644 --- a/chromium/base/files/file_util.h +++ b/chromium/base/files/file_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,6 +23,7 @@ #include "base/files/file_path.h" #include "base/files/scoped_file.h" #include "build/build_config.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #if BUILDFLAG(IS_WIN) #include "base/win/windows_types.h" @@ -192,6 +193,12 @@ BASE_EXPORT bool ContentsEqual(const FilePath& filename1, BASE_EXPORT bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2); +// Reads the file at |path| and returns a vector of bytes on success, and +// nullopt on error. For security reasons, a |path| containing path traversal +// components ('..') is treated as a read error, returning nullopt. +BASE_EXPORT absl::optional<std::vector<uint8_t>> ReadFileToBytes( + const FilePath& path); + // Reads the file at |path| into |contents| and returns true on success and // false on error. For security reasons, a |path| containing path traversal // components ('..') is treated as a read error and |contents| is set to empty. |