commit | 767ea5b1664c1a312098940049abdb69d955bc88 | [log] [tgz] |
---|---|---|
author | David Drysdale <drysdale@google.com> | Tue Oct 05 14:43:05 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Oct 05 14:43:05 2021 +0000 |
tree | c2d8f2e91f0de8e8a7415042b0dbbc8f301902b8 | |
parent | 70da8310a1a2a2365c0f2c8d4c99ca7e0b26c2ea [diff] | |
parent | b8dfd10b9b049ea51f54faf771f7fac6cc2e5a07 [diff] |
Merge "KeyMint VTS: don't crash on invalid patchlevel" am: e1152b6390 am: 4e9cab823d am: 69d66e13db am: b8dfd10b9b Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1844900 Change-Id: I2d26ac35e5f6bf16ec8aaa5825bc849507347a01
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp index fb720e8..37acfa9 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
@@ -1365,11 +1365,16 @@ att_hw_enforced[i].tag == TAG_VENDOR_PATCHLEVEL) { std::string date = std::to_string(att_hw_enforced[i].value.get<KeyParameterValue::integer>()); + // strptime seems to require delimiters, but the tag value will // be YYYYMMDD + if (date.size() != 8) { + ADD_FAILURE() << "Tag " << att_hw_enforced[i].tag + << " with invalid format (not YYYYMMDD): " << date; + return false; + } date.insert(6, "-"); date.insert(4, "-"); - EXPECT_EQ(date.size(), 10); struct tm time; strptime(date.c_str(), "%Y-%m-%d", &time);