From 9922aeeac4e3ae67e37d3344a79a750b49d4945c Mon Sep 17 00:00:00 2001 From: Alexander Bobrovnik Date: Fri, 12 Jan 2024 14:53:02 +0100 Subject: [PATCH] Fix uninitialized variable append_ in class constructors. b/219048469 --- base/files/file.cc | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/base/files/file.cc b/base/files/file.cc index 36ae9656ee83..488663361b0a 100644 --- a/base/files/file.cc +++ b/base/files/file.cc @@ -31,12 +31,24 @@ File::Info::~Info() = default; File::File() : error_details_(FILE_ERROR_FAILED), created_(false), - async_(false) { + async_(false) +#if defined(STARBOARD) + , + append_(false) +#endif +{ } #if !defined(OS_NACL) File::File(const FilePath& path, uint32_t flags) - : error_details_(FILE_OK), created_(false), async_(false) { + : error_details_(FILE_OK), + created_(false), + async_(false) +#if defined(STARBOARD) + , + append_(false) +#endif +{ Initialize(path, flags); } #endif @@ -47,7 +59,12 @@ File::File(PlatformFile platform_file, bool async) : file_(platform_file), error_details_(FILE_OK), created_(false), - async_(async) { + async_(async) +#if defined(STARBOARD) + , + append_(false) +#endif +{ #if defined(OS_POSIX) || defined(OS_FUCHSIA) DCHECK_GE(platform_file, -1); #endif @@ -56,7 +73,12 @@ File::File(PlatformFile platform_file, bool async) File::File(Error error_details) : error_details_(error_details), created_(false), - async_(false) { + async_(false) +#if defined(STARBOARD) + , + append_(false) +#endif +{ } File::File(File&& other) @@ -64,7 +86,13 @@ File::File(File&& other) tracing_path_(other.tracing_path_), error_details_(other.error_details()), created_(other.created()), - async_(other.async_) {} + async_(other.async_) +#if defined(STARBOARD) + , + append_(other.append_) +#endif +{ +} File::~File() { // Go through the AssertIOAllowed logic. @@ -78,6 +106,9 @@ File& File::operator=(File&& other) { error_details_ = other.error_details(); created_ = other.created(); async_ = other.async_; +#if defined(STARBOARD) + append_ = other.append_; +#endif return *this; }