ok2c commented on a change in pull request #174: Development
URL: 
https://github.com/apache/httpcomponents-core/pull/174#discussion_r361842980
 
 

 ##########
 File path: 
httpcore5-h2/src/main/java/org/apache/hc/core5/http2/hpack/HPackDecoder.java
 ##########
 @@ -287,13 +290,25 @@ public Header decodeHeader(final ByteBuffer src) throws 
HPackException {
     }
 
     public List<Header> decodeHeaders(final ByteBuffer src) throws 
HPackException {
+        final boolean enforceSizeLimit = maxListSize < Integer.MAX_VALUE;
+        int listSize = 0;
 
         final List<Header> list = new ArrayList<>();
         while (src.hasRemaining()) {
             final Header header = decodeHeader(src);
             if (header == null) {
                 break;
             }
+            if (enforceSizeLimit) {
+                listSize += header.getName().length() * 2;
+                if (header.getValue() != null) {
+                    listSize += header.getValue().length() * 2;
+                }
+                listSize += 32;
 
 Review comment:
   @rschmitt Fair enough. Makes sense. Please review 
9db8bf158441599de893d4f801dbb9ac71340eec

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to