Substring out of range test needs non-zero length value

Merge from Widevine repo of http://go/wvgerrit/154651

Some substring out of range tests uses non-zero offset but
with zero length. This zero length later will be ignored by
v15 oemcrypto, so the tests actually didn't test
anything. These tests are failing on v15 oemcrypto because
the test expect an out of range error but it actually
succeeded since nothing was tested.

Assign the offset to be out of range and then also assign
length to be not zero.

Test: run_fake_l1_tests; run_level3_static_tests;
Bug: 229299394
Test: tested with http://go/ag/20420224

Change-Id: Ic50b6323312e0ecb253dbeb925d9291db6eec075
This commit is contained in:
Cong Lin
2022-11-08 13:50:07 -08:00
committed by Fred Gylys-Colwell
parent 6161f812dc
commit 0ad587ca20

View File

@@ -3821,7 +3821,8 @@ TEST_P(OEMCryptoLicenseOverflowTest,
TestLoadLicenseForOutOfRangeSubStringOffSetAndLengths(
[](size_t response_message_length, LicenseRoundTrip* license_messages) {
auto& pst = license_messages->core_response().pst;
pst.offset = response_message_length - pst.length + 1;
pst.offset = response_message_length;
if (pst.length == 0) pst.length = 1;
});
}
@@ -3864,8 +3865,8 @@ TEST_P(
[](size_t response_message_length, LicenseRoundTrip* license_messages) {
auto& srm_restriction_data =
license_messages->core_response().srm_restriction_data;
srm_restriction_data.offset =
response_message_length - srm_restriction_data.length + 1;
srm_restriction_data.offset = response_message_length;
if (srm_restriction_data.length == 0) srm_restriction_data.length = 1;
});
}