You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2018/02/09 09:06:23 UTC

svn commit: r1823621 - in /tomcat/tc8.5.x/trunk: java/org/apache/coyote/http2/HpackDecoder.java webapps/docs/changelog.xml

Author: remm
Date: Fri Feb  9 09:06:23 2018
New Revision: 1823621

URL: http://svn.apache.org/viewvc?rev=1823621&view=rev
Log:
Add minor HPACK fixes, based on fixes by Stuart Douglas.

Modified:
    tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/HpackDecoder.java
    tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/HpackDecoder.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/HpackDecoder.java?rev=1823621&r1=1823620&r2=1823621&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/HpackDecoder.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/coyote/http2/HpackDecoder.java Fri Feb  9 09:06:23 2018
@@ -280,21 +280,23 @@ public class HpackDecoder {
      * @param index The index from the hpack
      * @return the real index into the array
      */
-    int getRealIndex(int index) {
+    int getRealIndex(int index) throws HpackException {
         //the index is one based, but our table is zero based, hence -1
         //also because of our ring buffer setup the indexes are reversed
         //index = 1 is at position firstSlotPosition + filledSlots
-        return (firstSlotPosition + (filledTableSlots - index)) % headerTable.length;
+        int realIndex = (firstSlotPosition + (filledTableSlots - index)) % headerTable.length;
+        if (realIndex < 0) {
+            throw new HpackException(sm.getString("hpackdecoder.headerTableIndexInvalid",
+                    Integer.valueOf(index), Integer.valueOf(Hpack.STATIC_TABLE_LENGTH),
+                    Integer.valueOf(filledTableSlots)));
+        }
+        return realIndex;
     }
 
     private void addStaticTableEntry(int index) throws HpackException {
         //adds an entry from the static table.
-        //this must be an entry with a value as far as I can determine
         Hpack.HeaderField entry = Hpack.STATIC_TABLE[index];
-        if (entry.value == null) {
-            throw new HpackException();
-        }
-        emitHeader(entry.name, entry.value);
+        emitHeader(entry.name, (entry.value == null) ? "" : entry.value);
     }
 
     private void addEntryToHeaderTable(Hpack.HeaderField entry) {

Modified: tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml?rev=1823621&r1=1823620&r2=1823621&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml Fri Feb  9 09:06:23 2018
@@ -52,6 +52,13 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        Add minor HPACK fixes, based on fixes by Stuart Douglas. (remm)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <add>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org