summaryrefslogtreecommitdiffstats
path: root/chromium/base/files/file.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2023-04-14 15:24:54 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2023-05-26 11:29:55 +0000
commitab965b1c2c3e7e4cd62a4b45abfaf393f4fb4618 (patch)
tree906ba4a71162c3ebcae0b742dbe01076af2abb22 /chromium/base/files/file.h
parent813d9ae984a99e739b99cf694a9d5b24d0a6b7a7 (diff)
BASELINE: Update Chromium to 112.0.5615.132
Change-Id: I59e23789618066826010171a36efbf8a68965ed0 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/472282 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/base/files/file.h')
-rw-r--r--chromium/base/files/file.h31
1 files changed, 20 insertions, 11 deletions
diff --git a/chromium/base/files/file.h b/chromium/base/files/file.h
index b09bdf70b1f..35abbc2e4cb 100644
--- a/chromium/base/files/file.h
+++ b/chromium/base/files/file.h
@@ -18,21 +18,12 @@
#include "base/trace_event/base_tracing_forward.h"
#include "build/build_config.h"
-#if BUILDFLAG(IS_BSD) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_NACL) || \
- BUILDFLAG(IS_FUCHSIA) || (BUILDFLAG(IS_ANDROID) && __ANDROID_API__ < 21)
struct stat;
-namespace base {
-typedef struct stat stat_wrapper_t;
-}
-#elif BUILDFLAG(IS_POSIX)
-struct stat64;
-namespace base {
-typedef struct stat64 stat_wrapper_t;
-}
-#endif
namespace base {
+using stat_wrapper_t = struct stat;
+
// Thin wrapper around an OS-level file.
// Note that this class does not provide any support for asynchronous IO, other
// than the ability to create asynchronous handles on Windows.
@@ -77,6 +68,10 @@ class BASE_EXPORT File {
FLAG_CAN_DELETE_ON_CLOSE = 1 << 20, // Requests permission to delete a file
// via DeleteOnClose() (Windows only).
// See DeleteOnClose() for details.
+ FLAG_WIN_NO_EXECUTE =
+ 1 << 21, // Windows only. Marks the file with a deny ACE that prevents
+ // opening the file with EXECUTE access. Cannot be used with
+ // FILE_WIN_EXECUTE flag. See also PreventExecuteMapping.
};
// This enum has been recorded in multiple histograms using PlatformFileError
@@ -380,6 +375,20 @@ class BASE_EXPORT File {
static int Lstat(const char* path, stat_wrapper_t* sb);
#endif
+ // This function can be used to augment `flags` with the correct flags
+ // required to create a File that can be safely passed to an untrusted
+ // process. It must be called if the File is intended to be transferred to an
+ // untrusted process, but can still be safely called even if the File is not
+ // intended to be transferred.
+ static constexpr uint32_t AddFlagsForPassingToUntrustedProcess(
+ uint32_t flags) {
+ if (flags & File::FLAG_WRITE || flags & File::FLAG_APPEND ||
+ flags & File::FLAG_WRITE_ATTRIBUTES) {
+ flags |= File::FLAG_WIN_NO_EXECUTE;
+ }
+ return flags;
+ }
+
private:
friend class FileTracing::ScopedTrace;