Bug 1962099 - QM: Restore metadata when unexpected reserved data is detected; r=dom-storage-reviewers,asuth
Update the origin metadata loading logic to detect and reject unexpected reserved data. If unexpected data is present, the metadata file is treated as incompatible, and restoration is triggered to ensure a consistent and valid state. This change protects both older and newer builds: - Older builds won’t misinterpret new metadata written by newer builds (although the chance of that is quite low). - Newer builds won’t incorrectly trust metadata files that were upgraded, then used by an older build, and used again, which is more likely and could lead to subtle or serious inconsistencies. Differential Revision: https://phabricator.services.mozilla.com/D246936
This commit is contained in:
committed by
jvarga@mozilla.com
parent
ba35ccece2
commit
fef3c421de
@@ -3546,7 +3546,9 @@ Result<FullOriginMetadata, nsresult> QuotaManager::LoadFullOriginMetadata(
|
|||||||
|
|
||||||
QM_TRY_INSPECT(const bool& reservedData1,
|
QM_TRY_INSPECT(const bool& reservedData1,
|
||||||
MOZ_TO_RESULT_INVOKE_MEMBER(binaryStream, Read32));
|
MOZ_TO_RESULT_INVOKE_MEMBER(binaryStream, Read32));
|
||||||
Unused << reservedData1;
|
if (reservedData1 != 0) {
|
||||||
|
QM_TRY(MOZ_TO_RESULT(false));
|
||||||
|
}
|
||||||
|
|
||||||
// XXX Use for the persistence type.
|
// XXX Use for the persistence type.
|
||||||
QM_TRY_INSPECT(const bool& reservedData2,
|
QM_TRY_INSPECT(const bool& reservedData2,
|
||||||
|
|||||||
Reference in New Issue
Block a user