Fix full-eng build breakage due to dbacd826a1.
am: 6e39c88b1e
Change-Id: I494d0bd10336ca9c8e771a6a341f6e06578bb59a
This commit is contained in:
commit
cb3d79385d
1 changed files with 10 additions and 6 deletions
|
|
@ -540,7 +540,7 @@ TEST(ziparchive, ExtractToFile) {
|
||||||
// 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 std::vector<uint8_t> kZipFileWithBrokenLfhSignature{
|
static const 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,
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
@ -571,12 +571,16 @@ static const std::vector<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) {
|
||||||
TemporaryFile tmp_file;
|
char kTempFilePattern[] = "zip_archive_input_XXXXXX";
|
||||||
ASSERT_NE(-1, tmp_file.fd);
|
int fd = make_temporary_file(kTempFilePattern);
|
||||||
ASSERT_TRUE(android::base::WriteFully(tmp_file.fd, &kZipFileWithBrokenLfhSignature[0],
|
ASSERT_NE(-1, fd);
|
||||||
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(tmp_file.fd, "LeadingNonZipBytes", &handle));
|
ASSERT_EQ(-1, OpenArchiveFd(fd, "LeadingNonZipBytes", &handle));
|
||||||
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue