Bug 1019577 - Always make room in the table before emitting an entry. r=mcmanus
authorNicholas Hurley <hurley@todesschaf.org>
Tue, 03 Jun 2014 13:09:08 -0700
changeset 206750 68ba56dc7149cf62ff4c69cadaadd371b33b62c8
parent 206749 e89d2416585f3c8ed09845f655c65b721551253d
child 206751 828b5db62ed085700089bd7199b8fcb33c0da534
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1019577
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1019577 - Always make room in the table before emitting an entry. r=mcmanus
netwerk/protocol/http/Http2Compression.cpp
--- a/netwerk/protocol/http/Http2Compression.cpp
+++ b/netwerk/protocol/http/Http2Compression.cpp
@@ -1465,20 +1465,27 @@ Http2Compressor::ProcessHeader(const nvP
         mImpliedReferenceSet.AppendElement(matchedIndex);
       mAlternateReferenceSet.AppendElement(matchedIndex);
       LOG(("Compressor state after NOP index"));
     }
     DumpState();
     return;
   }
 
+  // Need to ensure we have room for a new static entry before emitting
+  // anything, see bug 1019577
+  bool isStatic = (matchedIndex >= mHeaderTable.VariableLength());
+  if (isStatic) {
+    MakeRoom(newSize);
+  }
+
   // emit an index to add to reference set
   DoOutput(kToggleOn, &inputPair, matchedIndex);
-  if (matchedIndex >= mHeaderTable.VariableLength()) {
-    MakeRoom(newSize);
+
+  if (isStatic) {
     mHeaderTable.AddElement(inputPair.mName, inputPair.mValue);
     IncrementReferenceSetIndices();
     mAlternateReferenceSet.AppendElement(0);
   } else {
     mAlternateReferenceSet.AppendElement(matchedIndex);
   }
   LOG(("Compressor state after index"));
   DumpState();