Commit 64aa2059 authored by Istiaque Ahmed's avatar Istiaque Ahmed Committed by Commit Bot

Fix file reading success checking in image_sanitizer.cc

Bug: None
Change-Id: I6930083dabdb2596f8760737c8d9d474d41c2d27
Reviewed-on: https://chromium-review.googlesource.com/965621Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Istiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544261}
parent 34359918
...@@ -29,8 +29,9 @@ std::tuple<std::vector<uint8_t>, bool, bool> ReadAndDeleteBinaryFile( ...@@ -29,8 +29,9 @@ std::tuple<std::vector<uint8_t>, bool, bool> ReadAndDeleteBinaryFile(
int64_t file_size; int64_t file_size;
if (base::GetFileSize(path, &file_size)) { if (base::GetFileSize(path, &file_size)) {
contents.resize(file_size); contents.resize(file_size);
read_success = base::ReadFile( read_success =
path, reinterpret_cast<char*>(contents.data()), file_size); base::ReadFile(path, reinterpret_cast<char*>(contents.data()),
file_size) == file_size;
} }
bool delete_success = base::DeleteFile(path, /*recursive=*/false); bool delete_success = base::DeleteFile(path, /*recursive=*/false);
return std::make_tuple(std::move(contents), read_success, delete_success); return std::make_tuple(std::move(contents), read_success, delete_success);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment