Remove corrupted license file from storage.
(This is a port of http://go/wvgerrit/11614 from the Widevine repo.) CDM does not recover if a license file has invalid size or the hash is incorrect. Remove the corrupted license file in such cases. bug: 18002606 Change-Id: I46dec853ce6b2e7c7430297d50df5d30488cde3b
This commit is contained in:
@@ -603,6 +603,9 @@ bool DeviceFiles::RetrieveFile(const char* name, std::string* serialized_file) {
|
|||||||
ssize_t bytes = file_->FileSize(path);
|
ssize_t bytes = file_->FileSize(path);
|
||||||
if (bytes <= 0) {
|
if (bytes <= 0) {
|
||||||
LOGW("DeviceFiles::RetrieveFile: File size invalid: %s", path.c_str());
|
LOGW("DeviceFiles::RetrieveFile: File size invalid: %s", path.c_str());
|
||||||
|
// Remove the corrupted file so the caller will not get the same error
|
||||||
|
// when trying to access the file repeatedly, causing the system to stall.
|
||||||
|
file_->Remove(path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,6 +640,9 @@ bool DeviceFiles::RetrieveFile(const char* name, std::string* serialized_file) {
|
|||||||
|
|
||||||
if (hash.compare(hash_file.hash())) {
|
if (hash.compare(hash_file.hash())) {
|
||||||
LOGW("DeviceFiles::RetrieveFile: Hash mismatch");
|
LOGW("DeviceFiles::RetrieveFile: Hash mismatch");
|
||||||
|
// Remove the corrupted file so the caller will not get the same error
|
||||||
|
// when trying to access the file repeatedly, causing the system to stall.
|
||||||
|
file_->Remove(path);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user