Support for IPv6 in HTTP socket and BufferReader unittests
* Add Apple MD5 support in DeviceFiles [ Merge of http://go/wvgerrit/15544 ] Patch courtesy of Spotify. * Changing vague BufferReader log message [ Merge of http://go/wvgerrit/15515 ] Amending the buffer reader log message for null parameters in the read function to say the type of parameter to help tell the difference between Read2, Read2s, Read4, Read4s, Read8, and Read8s. Bug: 23619044 * Fix HTTP socket tests [ Merge of http://go/wvgerrit/15521 ] This fixes the build on Jenkins. I missed these when I updated HTTP socket because they are not part of the CE CDM test suite. * Update HttpSocket for IPv6 [ Merge of http://go/wvgerrit/15517 ] Previously, HttpSocket made assumptions about IPv4. This CL updates this utility to be agnostic to IPv4 vs IPv6. If our servers start resolving to IPv6 addresses in future, our tests can now handle this transparently. * Removed low level warnings from PSSH [ Merge of http://go/wvgerrit/15489 ] Unneeded warnings in parsing PSSH and in buffer reader were appearing in the logs. LOGW commands were replaced with LOGV. Bug: 23419359 * BufferReader unit tests and hardening. [ Merge of http://go/wvgerrit/15449 ] Added unit tests for public-facing functions. Added protection against null or negative parameters. Bug: 23419008 Change-Id: Ia44100a2d1bafe68986ae9a0793214885b21e61e
This commit is contained in:
@@ -61,18 +61,18 @@ bool InitializationData::ExtractWidevinePssh(const CdmInitData& init_data,
|
||||
// atom size, used for skipping.
|
||||
uint64_t size;
|
||||
if (!reader.Read4Into8(&size)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to read atom size.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to read atom size.");
|
||||
return false;
|
||||
}
|
||||
std::vector<uint8_t> atom_type;
|
||||
if (!reader.ReadVec(&atom_type, 4)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to read atom type.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to read atom type.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (size == 1) {
|
||||
if (!reader.Read8(&size)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to read 64-bit atom "
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to read 64-bit atom "
|
||||
"size.");
|
||||
return false;
|
||||
}
|
||||
@@ -82,10 +82,10 @@ bool InitializationData::ExtractWidevinePssh(const CdmInitData& init_data,
|
||||
|
||||
// "pssh"
|
||||
if (memcmp(&atom_type[0], "pssh", 4)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: PSSH literal not present.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: PSSH literal not present.");
|
||||
if (!reader.SkipBytes(size - (reader.pos() - start_pos))) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to skip the rest of the "
|
||||
"atom.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to skip the rest of "
|
||||
"the atom.");
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
@@ -94,15 +94,15 @@ bool InitializationData::ExtractWidevinePssh(const CdmInitData& init_data,
|
||||
// version
|
||||
uint8_t version;
|
||||
if (!reader.Read1(&version)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to read PSSH version.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to read PSSH version.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (version > 1) {
|
||||
// unrecognized version - skip.
|
||||
if (!reader.SkipBytes(size - (reader.pos() - start_pos))) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to skip the rest of the "
|
||||
"atom.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to skip the rest of "
|
||||
"the atom.");
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
@@ -110,22 +110,22 @@ bool InitializationData::ExtractWidevinePssh(const CdmInitData& init_data,
|
||||
|
||||
// flags
|
||||
if (!reader.SkipBytes(3)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to skip the PSSH flags.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to skip the PSSH flags.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// system id
|
||||
std::vector<uint8_t> system_id;
|
||||
if (!reader.ReadVec(&system_id, sizeof(kWidevineSystemId))) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to read system ID.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to read system ID.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (memcmp(&system_id[0], kWidevineSystemId, sizeof(kWidevineSystemId))) {
|
||||
// skip non-Widevine PSSH boxes.
|
||||
if (!reader.SkipBytes(size - (reader.pos() - start_pos))) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to skip the rest of the "
|
||||
"atom.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to skip the rest of "
|
||||
"the atom.");
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
@@ -135,11 +135,11 @@ bool InitializationData::ExtractWidevinePssh(const CdmInitData& init_data,
|
||||
// v1 has additional fields for key IDs. We can skip them.
|
||||
uint32_t num_key_ids;
|
||||
if (!reader.Read4(&num_key_ids)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to read num key IDs.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to read num key IDs.");
|
||||
return false;
|
||||
}
|
||||
if (!reader.SkipBytes(num_key_ids * 16)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to skip key IDs.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to skip key IDs.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -147,13 +147,13 @@ bool InitializationData::ExtractWidevinePssh(const CdmInitData& init_data,
|
||||
// size of PSSH data
|
||||
uint32_t data_length;
|
||||
if (!reader.Read4(&data_length)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to read PSSH data size.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to read PSSH data size.");
|
||||
return false;
|
||||
}
|
||||
|
||||
output->clear();
|
||||
if (!reader.ReadString(output, data_length)) {
|
||||
LOGW("CdmEngine::ExtractWidevinePssh: Unable to read PSSH data.");
|
||||
LOGV("CdmEngine::ExtractWidevinePssh: Unable to read PSSH data.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user