High firefox Logic Error 🔧 Commit mapped

Overview

High
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Impacthigh
DescriptionUninitialized memory in the Storage: Quota Manager component
ComponentDOM
Bug ClassLogic Error
Tracker2054736
Fix commitc879f071e8fb (firefox) +21/-2
CISA KEVNot listed
CreditedMozilla
Disclosed2026-09-29

Changed Functions

FunctionChangeNotes
if
dom/quota/DecryptingInputStream_impl.h
modified

Files Changed

  • dom/quota/DecryptingInputStream_impl.h
diff --git a/dom/quota/DecryptingInputStream_impl.h b/dom/quota/DecryptingInputStream_impl.h
index 490c6c21446..384368eea6e 100644
--- a/dom/quota/DecryptingInputStream_impl.h
+++ b/dom/quota/DecryptingInputStream_impl.h
@@ -515,8 +515,27 @@ NS_IMETHODIMP DecryptingInputStream<CipherStrategy>::Seek(const int32_t aWhence,
   }
 
   if (readBytes == 0 && baseBlocksOffset != 0) {
-    mPlainBytes = mEncryptedBlock->MaxPayloadLength();
-    mNextByte = mEncryptedBlock->MaxPayloadLength();
+    // EOF at a block boundary: re-parse the preceding (full) block so that
+    // mPlainBuffer really contains mPlainBytes bytes read calls might request.
+    // Fabricating the counts without decrypting would let a later
+    // in-block seek serve uninitialized buffer contents (see bug 2054736).
+    rv = (*mBaseSeekableStream)
+             ->Seek(NS_SEEK_SET, (baseBlocksOffset - 1) * *mBlockSize);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
+    rv = ParseNextChunk(true /* aCheckAvailableBytes */, &readBytes);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
+    if (NS_WARN_IF(readBytes != mEncryptedBlock->MaxPayloadLength())) {
+      return NS_ERROR_CORRUPTED_CONTENT;
+    }
+
+    mPlainBytes = readBytes;
+    mNextByte = readBytes;
   } else {
     mPlainBytes = readBytes;
     mNextByte = nextByteOffset;
Loading diff…