Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97ea07de authored by Narayan Kamath's avatar Narayan Kamath Committed by android-build-merger
Browse files

Revert "Fix full-eng build breakage due to dbacd826." am: d5715c5d...

Revert "Fix full-eng build breakage due to dbacd826." am: d5715c5d am: c6b5b671 am: f9b3f6b9 am: 18330888 am: 6a7e3ac8
am: 98310164

Change-Id: I3fe6fda6680eb639b704d1dfcc9c45a7d33b1f0e
parents 2d319cda 98310164
Loading
Loading
Loading
Loading
+6 −10
Original line number Original line Diff line number Diff line
@@ -652,7 +652,7 @@ TEST(ziparchive, StreamUncompressedBadCrc) {
// Manual changes :
// Manual changes :
// [2] = 0xff  // Corrupt the LFH signature of entry 0.
// [2] = 0xff  // Corrupt the LFH signature of entry 0.
// [3] = 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---------------------------------
    //[lfh-sig-----------], [lfh contents---------------------------------
    0x50, 0x4b, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x80,
    0x50, 0x4b, 0xff, 0xff, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x80,
    //--------------------------------------------------------------------
    //--------------------------------------------------------------------
@@ -683,16 +683,12 @@ static const uint8_t kZipFileWithBrokenLfhSignature[] = {
    0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00};
    0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00};


TEST(ziparchive, BrokenLfhSignature) {
TEST(ziparchive, BrokenLfhSignature) {
  char kTempFilePattern[] = "zip_archive_input_XXXXXX";
  TemporaryFile tmp_file;
  int fd = make_temporary_file(kTempFilePattern);
  ASSERT_NE(-1, tmp_file.fd);
  ASSERT_NE(-1, fd);
  ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, &kZipFileWithBrokenLfhSignature[0],

                                        kZipFileWithBrokenLfhSignature.size()));
  ASSERT_EQ(static_cast<int32_t>(sizeof(kZipFileWithBrokenLfhSignature)),
      TEMP_FAILURE_RETRY(write(fd, kZipFileWithBrokenLfhSignature,
                               sizeof(kZipFileWithBrokenLfhSignature))));
  ZipArchiveHandle handle;
  ZipArchiveHandle handle;
  ASSERT_EQ(-1, OpenArchiveFd(fd, "LeadingNonZipBytes", &handle));
  ASSERT_EQ(-1, OpenArchiveFd(tmp_file.fd, "LeadingNonZipBytes", &handle));
  close(fd);
}
}


int main(int argc, char** argv) {
int main(int argc, char** argv) {