From c3b13a783cb2e4855d498af1a8d97cc51d07bf46 Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Mon, 23 May 2016 14:30:44 -0700 Subject: [PATCH] Fix oat_writer to use WriteData which updates checksum. OatWriter was using WriteFully in some places instead. Bug: 28874264 (cherry-picked from commit 5e7cbde3100b0bfb58277accc9d71a94636ea727) Change-Id: I7dac3ad0597c210ba6e12e0cc1670277d7a28fc7 --- compiler/oat_writer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc index 140db0c56..1aa26090a 100644 --- a/compiler/oat_writer.cc +++ b/compiler/oat_writer.cc @@ -2013,7 +2013,7 @@ bool OatWriter::WriteDexFile(OutputStream* rodata, DCHECK(ValidateDexFileHeader(dex_file, oat_dex_file->GetLocation())); const UnalignedDexFileHeader* header = AsUnalignedDexFileHeader(dex_file); - if (!rodata->WriteFully(dex_file, header->file_size_)) { + if (!WriteData(rodata, dex_file, header->file_size_)) { PLOG(ERROR) << "Failed to write dex file " << oat_dex_file->GetLocation() << " to " << rodata->GetLocation(); return false; @@ -2193,7 +2193,7 @@ bool OatWriter::WriteCodeAlignment(OutputStream* out, uint32_t aligned_code_delt 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u }; DCHECK_LE(aligned_code_delta, sizeof(kPadding)); - if (UNLIKELY(!out->WriteFully(kPadding, aligned_code_delta))) { + if (UNLIKELY(!WriteData(out, kPadding, aligned_code_delta))) { return false; } size_code_alignment_ += aligned_code_delta; -- 2.11.0