Firefox · Toolkit
CVE-2026-92072
Logic Error in Toolkit
Overview
Low
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Files Changed
toolkit/components/url-classifier/ProtocolParser.cpp
Patch
diff --git a/toolkit/components/url-classifier/ProtocolParser.cpp b/toolkit/components/url-classifier/ProtocolParser.cpp
index ee1b410541f..a07a8a44a79 100644
--- a/toolkit/components/url-classifier/ProtocolParser.cpp
+++ b/toolkit/components/url-classifier/ProtocolParser.cpp
@@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ProtocolParser.h"
+#include "Entries.h"
#include "LookupCache.h"
#include "nsNetCID.h"
#include "mozilla/Components.h"
@@ -412,6 +413,12 @@ nsresult ProtocolParserV2::ProcessPlaintextChunk(const nsACString& aChunk) {
nsresult ProtocolParserV2::ProcessShaChunk(const nsACString& aChunk) {
uint32_t start = 0;
while (start < aChunk.Length()) {
+ // Each chunk must be at least 5 bytes (domain + count))
+ if (aChunk.Length() - start < DOMAIN_SIZE + 1) {
+ NS_WARNING("Chunk is not long enough to contain the record header.");
+ return NS_ERROR_FAILURE;
+ }
+
// First four bytes are the domain key.
Prefix domain;
domain.Assign(Substring(aChunk, start, DOMAIN_SIZE));
@@ -466,8 +473,10 @@ nsresult ProtocolParserV2::ProcessDigestChunk(const nsACString& aChunk) {
nsresult ProtocolParserV2::ProcessDigestAdd(const nsACString& aChunk) {
MOZ_ASSERT(mTableUpdate);
// The ABNF format for add chunks is (HASH)+, where HASH is 32 bytes.
- MOZ_ASSERT(aChunk.Length() % 32 == 0,
- "Chunk length in bytes must be divisible by 4");
+ if (aChunk.Length() % COMPLETE_SIZE != 0) {
+ NS_WARNING("Chunk length in bytes must be divisible by 32");
+ return NS_ERROR_FAILURE;
+ }
uint32_t start = 0;
while (start < aChunk.Length()) {
Completion hash;
@@ -485,8 +494,10 @@ nsresult ProtocolParserV2::ProcessDigestSub(const nsACString& aChunk) {
MOZ_ASSERT(mTableUpdate);
// The ABNF format for sub chunks is (ADDCHUNKNUM HASH)+, where ADDCHUNKNUM
// is a 4 byte chunk number, and HASH is 32 bytes.
- MOZ_ASSERT(aChunk.Length() % 36 == 0,
- "Chunk length in bytes must be divisible by 36");
+ if (aChunk.Length() % (4 + COMPLETE_SIZE) != 0) {
+ NS_WARNING("Chunk length in bytes must be divisible by 36");
+ return NS_ERROR_FAILURE;
+ }
uint32_t start = 0;
while (start < aChunk.Length()) {
// Read ADDCHUNKNUM
Loading diff…
References
On This Page