Skip to content

Commit

Permalink
Fix uninitialized variable append_ in class constructors.
Browse files Browse the repository at this point in the history
b/219048469
  • Loading branch information
alexanderbobrovnik committed Jan 12, 2024
1 parent 98da637 commit 9922aee
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions base/files/file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -56,15 +73,26 @@ 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)
: file_(other.TakePlatformFile()),
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.
Expand All @@ -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;
}

Expand Down

0 comments on commit 9922aee

Please sign in to comment.