This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new ea548ea Fix potential infinite loop in SSL tests
ea548ea is described below
commit ea548eaa15a549fd3ea3d7e0f953597c55fc144b
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Dec 7 08:58:00 2020 +0000
Fix potential infinite loop in SSL tests
---
test/org/apache/tomcat/util/net/TestSsl.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/test/org/apache/tomcat/util/net/TestSsl.java
b/test/org/apache/tomcat/util/net/TestSsl.java
index df70006..ce42f55 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -125,7 +125,13 @@ public class TestSsl extends TomcatBaseTest {
byte[] endOfHeaders = "\r\n\r\n".getBytes();
int found = 0;
while (found != endOfHeaders.length) {
- if (is.read() == endOfHeaders[found]) {
+ int c = is.read();
+ if (c == -1) {
+ // EOF
+ System.err.println("Unexpected EOF");
+ errorCount.incrementAndGet();
+ break;
+ } else if (c == endOfHeaders[found]) {
found++;
} else {
found = 0;
@@ -252,7 +258,11 @@ public class TestSsl extends TomcatBaseTest {
char[] endOfHeaders ="\r\n\r\n".toCharArray();
int found = 0;
while (found != endOfHeaders.length) {
- if (r.read() == endOfHeaders[found]) {
+ int c = r.read();
+ if (c == -1) {
+ // EOF
+ Assert.fail("Unexpected EOF");
+ } else if (c == endOfHeaders[found]) {
found++;
} else {
found = 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]