Author: remm Date: Wed Mar 29 14:03:11 2017 New Revision: 1789369 URL: http://svn.apache.org/viewvc?rev=1789369&view=rev Log: Cleanup HPACK decoding exception.
Modified: tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java?rev=1789369&r1=1789368&r2=1789369&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java (original) +++ tomcat/trunk/java/org/apache/coyote/http2/HpackDecoder.java Wed Mar 29 14:03:11 2017 @@ -244,11 +244,11 @@ public class HpackDecoder { throw new HpackException(); } int adjustedIndex = getRealIndex(index - Hpack.STATIC_TABLE_LENGTH); - Hpack.HeaderField res = headerTable[adjustedIndex]; - if (res == null) { + Hpack.HeaderField headerField = headerTable[adjustedIndex]; + if (headerField == null) { throw new HpackException(); } - return res.name; + return headerField.name; } } @@ -262,8 +262,14 @@ public class HpackDecoder { if (index <= Hpack.STATIC_TABLE_LENGTH) { addStaticTableEntry(index); } else { + if (index >= Hpack.STATIC_TABLE_LENGTH + filledTableSlots) { + throw new HpackException(); + } int adjustedIndex = getRealIndex(index - Hpack.STATIC_TABLE_LENGTH); Hpack.HeaderField headerField = headerTable[adjustedIndex]; + if (headerField == null) { + throw new HpackException(); + } emitHeader(headerField.name, headerField.value); } } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1789369&r1=1789368&r2=1789369&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Mar 29 14:03:11 2017 @@ -54,6 +54,14 @@ </update> </changelog> </subsection> + <subsection name="Coyote"> + <changelog> + <fix> + Cleanup possible index out of bounds exception processing an invalid + index in HPACK. (remm) + </fix> + </changelog> + </subsection> </section> <section name="Tomcat 9.0.0.M19 (markt)" rtext="release in progress"> <subsection name="Catalina"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org