From 71b556d262db33545e10ef565f2f3fc8e01baf53 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 | 11 ++++++++++- base/files/file.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/base/files/file.cc b/base/files/file.cc index 36ae9656ee83..db43fadf4c73 100644 --- a/base/files/file.cc +++ b/base/files/file.cc @@ -64,7 +64,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 +84,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; } diff --git a/base/files/file.h b/base/files/file.h index 336fe37b0245..443abf8886ee 100644 --- a/base/files/file.h +++ b/base/files/file.h @@ -380,7 +380,7 @@ class BASE_EXPORT File { bool async_; #if defined(STARBOARD) - bool append_; + bool append_ = false; #endif DISALLOW_COPY_AND_ASSIGN(File);