You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/07/24 13:22:42 UTC

[tomcat] 02/02: Fix h2spec test suite failure. EOS in Huffman encoded string literal.

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit ca871dff3be73dd33437907b40049eea401b01ab
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jul 24 14:22:05 2019 +0100

    Fix h2spec test suite failure. EOS in Huffman encoded string literal.
    
    Patch by jfclere
---
 java/org/apache/coyote/http2/HPackHuffman.java       | 5 +++++
 java/org/apache/coyote/http2/LocalStrings.properties | 1 +
 webapps/docs/changelog.xml                           | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/java/org/apache/coyote/http2/HPackHuffman.java b/java/org/apache/coyote/http2/HPackHuffman.java
index 637e690..365a6f9 100644
--- a/java/org/apache/coyote/http2/HPackHuffman.java
+++ b/java/org/apache/coyote/http2/HPackHuffman.java
@@ -404,6 +404,11 @@ public class HPackHuffman {
                     if ((val & HIGH_TERMINAL_BIT) == 0) {
                         treePos = (val >> 16) & LOW_MASK;
                     } else {
+                        if (eosBitCount != 0) {
+                            // This must be the EOS symbol which MUST be treated
+                            // as an error
+                            throw new HpackException(sm.getString("hpackhuffman.stringLiteralEOS"));
+                        }
                         target.append((char) ((val >> 16) & LOW_MASK));
                         treePos = 0;
                         eosBits = true;
diff --git a/java/org/apache/coyote/http2/LocalStrings.properties b/java/org/apache/coyote/http2/LocalStrings.properties
index 498a217..83afc74 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -44,6 +44,7 @@ hpackdecoder.tableSizeUpdateNotAtStart=Any table size update must be sent at the
 hpackdecoder.zeroNotValidHeaderTableIndex=Zero is not a valid header table index
 
 hpackhuffman.huffmanEncodedHpackValueDidNotEndWithEOS=Huffman encoded value in HPACK headers did not end with EOS padding
+hpackhuffman.stringLiteralEOS=Huffman encoded value in HPACK headers contained the EOS symbol
 hpackhuffman.stringLiteralTooMuchPadding=More than 7 bits of EOS padding were provided at the end of an Huffman encoded string literal
 
 http2Parser.error=Connection [{0}], Stream [{1}], Frame type [{2}], Error
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b04ebcb..46c39fa 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -103,6 +103,10 @@
         <bug>63578</bug>: Improve handling of invalid requests so that 400
         responses are returned to the client rather than 500 responses. (markt)
       </fix>
+      <fix>
+        Fix h2spec test suite failure. It is an error if a Huffman encoded
+        string literal contains the EOS symbol. (jfclere)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">


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