6f268b
commit 7f474ba097347fbe4c3db776b46eef59a587c0aa
6f268b
Author: Coty Sutherland <csutherl@apache.org>
6f268b
Date:   Tue Sep 19 14:22:06 2017 +0000
6f268b
6f268b
    Update fix for bug 59904 so that values less than zero are accepted instead of throwing a NegativeArraySizeException.
6f268b
    
6f268b
    git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk@1808887 13f79535-47bb-0310-9956-ffa450edef68
6f268b
6f268b
diff --git a/java/org/apache/tomcat/util/http/Cookies.java b/java/org/apache/tomcat/util/http/Cookies.java
6f268b
index 5ae71ec97c..511bbf3243 100644
6f268b
--- java/org/apache/tomcat/util/http/Cookies.java
6f268b
+++ java/org/apache/tomcat/util/http/Cookies.java
6f268b
@@ -134,7 +134,7 @@ public final class Cookies {
6f268b
         }
6f268b
 
6f268b
         if (cookieCount >= scookies.length) {
6f268b
-            int newSize = Math.min(2*cookieCount, limit);
6f268b
+            int newSize = limit > -1 ? Math.min(2*cookieCount, limit) : 2*cookieCount;
6f268b
             ServerCookie scookiesTmp[] = new ServerCookie[newSize];
6f268b
             System.arraycopy( scookies, 0, scookiesTmp, 0, cookieCount);
6f268b
             scookies=scookiesTmp;
6f268b
diff -up webapps/docs/changelog.xml.orig webapps/docs/changelog.xml
6f268b
--- webapps/docs/changelog.xml.orig	2019-03-01 13:04:17.093997197 -0500
6f268b
+++ webapps/docs/changelog.xml	2019-03-01 13:05:04.168868394 -0500
6f268b
@@ -92,6 +92,14 @@
6f268b
       </fix>
6f268b
     </changelog>
6f268b
   </subsection>
6f268b
+  <subsection name="Other">
6f268b
+    <changelog>
6f268b
+      <fix> 
6f268b
+        Update fix for <bug>59904</bug> so that values less than zero are accepted
6f268b
+        instead of throwing a NegativeArraySizeException. (remm)
6f268b
+      </fix>
6f268b
+    </changelog>
6f268b
+  </subsection>
6f268b
 </section>
6f268b
 <section name="Tomcat 7.0.76-8 (csutherl)">
6f268b
   <subsection name="Catalina">