Revert "Fix full-eng build breakage due to dbacd826a100f2c." am: d5715c5d2d am: c6b5b67139 am: f9b3f6b9e6 am: 1833088893 am: 6a7e3ac83b am: 983101645f

am: 97ea07ded3

Change-Id: I6951ce5487188998f19fd5fad52160b220610269
This commit is contained in:
Narayan Kamath 2017-10-04 18:05:11 +00:00 committed by android-build-merger
commit eed0d07ce1

View file

@ -727,7 +727,7 @@ TEST(ziparchive, ErrorCodeString) {
// Manual changes :
// [2] = 0xff // Corrupt the LFH signature of entry 0.
// [3] = 0xff // Corrupt the LFH signature of entry 0.
static const uint8_t kZipFileWithBrokenLfhSignature[] = {
static const std::vector<uint8_t> kZipFileWithBrokenLfhSignature{
//[lfh-sig-----------], [lfh contents---------------------------------
0x50, 0x4b, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x80,
//--------------------------------------------------------------------
@ -758,16 +758,12 @@ static const uint8_t kZipFileWithBrokenLfhSignature[] = {
0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00};
TEST(ziparchive, BrokenLfhSignature) {
char kTempFilePattern[] = "zip_archive_input_XXXXXX";
int fd = make_temporary_file(kTempFilePattern);
ASSERT_NE(-1, fd);
ASSERT_EQ(static_cast<int32_t>(sizeof(kZipFileWithBrokenLfhSignature)),
TEMP_FAILURE_RETRY(write(fd, kZipFileWithBrokenLfhSignature,
sizeof(kZipFileWithBrokenLfhSignature))));
TemporaryFile tmp_file;
ASSERT_NE(-1, tmp_file.fd);
ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, &kZipFileWithBrokenLfhSignature[0],
kZipFileWithBrokenLfhSignature.size()));
ZipArchiveHandle handle;
ASSERT_EQ(-1, OpenArchiveFd(fd, "LeadingNonZipBytes", &handle));
close(fd);
ASSERT_EQ(-1, OpenArchiveFd(tmp_file.fd, "LeadingNonZipBytes", &handle));
}
int main(int argc, char** argv) {