зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1702600 - Change ToInteger to ToInteger64 in ClientUsageArray::Deserialize; r=dom-storage-reviewers,jstutte
We use uint64_t for usages internally, but the deserializing function was using ToInteger which can handle only 32bit integers. The problem became more visible after increasing the group limit from 2GB to 10GB, but it was possible to experience the problem even before that because persisted origins are not limited by the group limit. Differential Revision: https://phabricator.services.mozilla.com/D148480
This commit is contained in:
Родитель
8b2ddb2b2c
Коммит
d88413ed98
|
@ -70,7 +70,7 @@ class Client {
|
|||
};
|
||||
|
||||
static Type TypeMax() {
|
||||
if (CachedNextGenLocalStorageEnabled()) {
|
||||
if (NextGenLocalStorageEnabled()) {
|
||||
return TYPE_MAX;
|
||||
}
|
||||
return LS;
|
||||
|
|
|
@ -43,7 +43,7 @@ nsresult ClientUsageArray::Deserialize(const nsACString& aText) {
|
|||
NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv;
|
||||
const uint64_t usage = Substring(token, 1).ToInteger(&rv);
|
||||
const uint64_t usage = Substring(token, 1).ToInteger64(&rv);
|
||||
QM_TRY(MOZ_TO_RESULT(rv));
|
||||
|
||||
ElementAt(clientType) = Some(usage);
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ClientUsageArray.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace mozilla::dom::quota;
|
||||
|
||||
TEST(DOM_Quota_ClientUsageArray, Deserialize)
|
||||
{
|
||||
ClientUsageArray clientUsages;
|
||||
nsresult rv = clientUsages.Deserialize("I872215 C8404073805 L161709"_ns);
|
||||
ASSERT_EQ(rv, NS_OK);
|
||||
}
|
|
@ -12,6 +12,7 @@ EXPORTS.mozilla.dom.quota += [
|
|||
UNIFIED_SOURCES = [
|
||||
"Common.cpp",
|
||||
"TestCheckedUnsafePtr.cpp",
|
||||
"TestClientUsageArray.cpp",
|
||||
"TestEncryptedStream.cpp",
|
||||
"TestFlatten.cpp",
|
||||
"TestForwardDecls.cpp",
|
||||
|
|
Загрузка…
Ссылка в новой задаче