Merge "Add a checker for signature boundary in verifier"

This commit is contained in:
Tianjie Xu
2016-12-19 20:44:36 +00:00
committed by Android (Google) Code Review
3 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -155,4 +155,5 @@ INSTANTIATE_TEST_CASE_P(BadPackage, VerifierFailureTest,
std::vector<std::string>({"random.zip", "v1"}),
std::vector<std::string>({"fake-eocd.zip", "v1"}),
std::vector<std::string>({"alter-metadata.zip", "v1"}),
std::vector<std::string>({"alter-footer.zip", "v1"})));
std::vector<std::string>({"alter-footer.zip", "v1"}),
std::vector<std::string>({"signature-boundary.zip", "v1"})));
Binary file not shown.
+6
View File
@@ -147,6 +147,12 @@ int verify_file(unsigned char* addr, size_t length,
LOG(INFO) << "comment is " << comment_size << " bytes; signature is " << signature_start
<< " bytes from end";
if (signature_start > comment_size) {
LOG(ERROR) << "signature start: " << signature_start << " is larger than comment size: "
<< comment_size;
return VERIFY_FAILURE;
}
if (signature_start <= FOOTER_SIZE) {
LOG(ERROR) << "Signature start is in the footer";
return VERIFY_FAILURE;